Closed andresbott closed 9 years ago
also refer the attribude "value"=>[0,2], as the preselected values
@odosuiadan Thanks for suggestion. We are truly busy and any help regarding documentation (pull requests) would be more than welcomed.
In our plans we want to build a website to provide full documentation on every one of the extensions that we share to the community but, as said, truly busy...
To get the value
working and get pre-selected items I had to put it into options
"options" => ['multiple'=>"multiple", "value"=>[0,2] ]
how to multiple selected many object? actionUpdate $cat = Category::find()->all();
$categoryEmploye = CategoryEmploye::find()->where(['employe_id' => $model->id])->all();
view $catArray = \yii\helpers\ArrayHelper::map($cat, 'id', 'title');
<?= $form->field($categoryEmploye, 'category_id')->widget(\dosamigos\multiselect\MultiSelect::className(),[ 'data' => [$catArray], "options" => ['multiple'=>"multiple"], 'clientOptions' => [ 'multiple' => true, ] ]) ?>
Hi, please make a litte better documentation i had to dig into the code.
please add some examples like this:
echo MultiSelect::widget([ 'id'=>"multiXX", "options"=>['multiple'=>"multiple"], // for the actual multiselect 'data' => [0=>'super', 2=>'natural'], // data as array 'name' => 'multti', // name for the form "clientOptions"=>["includeSelectAllOption"=>true,'numberDisplayed'=>2], // js options ]);
also refear that if a model is provided, the model is used; i asume with option "model"=>$model (did not try it)