yii2:drop-down list for multiple values concat in one line

后端 未结 4 1978
梦如初夏
梦如初夏 2020-12-14 17:06

for my drop-down list I am using this code.

field($medicinerequest, \'[\' . $id . \']\' . \'medicine_name\')
->DropDownList(ArrayHelper::         


        
4条回答
  •  孤街浪徒
    2020-12-14 18:04

    You can set $var in kartik Depdrop widget, as the same scenario in the Dropdown widget here We use kartik depdrop widget

    where(['id' => $model->customer_id])->all(), 'id',
                function ($model) {
                    return $model['id'] .' - '. $model['name'];
                });
            echo $form->field($model, 'id')->widget(DepDrop::classname(), [
                'data' => $var,
                'pluginOptions' => [
                    'depends' => [''],
                    'url' => Url::to(['#'])
                ]
            ]) ?>
    

提交回复
热议问题