Typed text not getting removed from kartik select2 after seleting option

335 Views Asked by At

Hi i am using kartik select2 in my yii application. The select box for selecting multiple options is working fine. However i am facing one small issue. enter image description here

Like if i type ba then it will display all matching options. but when i press enter then Bakam get selected but the text ba remains in select box. It should get removed. enter image description here

Here is code for my select box

<?= $form->field($model, 'area')->widget(Select2::classname(), [
                    'data' => [],
                    'options' => ['placeholder' => 'Select Location'],
                    'pluginOptions' => [
                        'closeOnSelect' => false,
                        'tags' => false,
                        'multiple' => true,
                    ],
                ])->label("Reassign Location")
                ?>

I checked it on kartik website the code seems fine then why the text remains there?

1

There are 1 best solutions below

0
On BEST ANSWER

Set 'closeOnSelect' => true, in pluginOptions to remove selected option.