php - Checkbox for each item in select2 multiple select -
im using select2 multiple select, in im getting items on search, have option of selectall , unseclect all. want have checkbox in front of items. tags, can check items @ once , done.. current code.
$form->field($tags, 'tag_id')->widget(select2::classname(), [ 'data' => arrayhelper::map(tags::find()->where([])->all(), 'id', 'tag_name'), 'language' => 'en', 'options' => ['placeholder' => 'select tags'], 'pluginoptions' => [ 'allowclear' => true, 'multiple' => true, ], ])->label(false);
$data = [ "red" => "red", "green" => "green", "blue" => "blue", "orange" => "orange", "white" => "white", "black" => "black", "purple" => "purple", "cyan" => "cyan", "teal" => "teal" ]; // tagging support multiple $model->colortags = ['red', 'green']; // initial value echo $form->field($model, 'colortags')->widget(select2::classname(), [ 'data' => $data, 'options' => ['placeholder' => 'select color ...', 'multiple' => true], 'pluginoptions' => [ 'tags' => true, 'tokenseparators' => [',', ' '], 'maximuminputlength' => 10 ], ])->label('tag multiple');
Comments
Post a Comment