Ninja Turtle
Ninja Turtle

Reputation: 1363

Typed text not getting removed from kartik select2 after seleting option

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?

Upvotes: 0

Views: 344

Answers (1)

Mohan
Mohan

Reputation: 616

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

Upvotes: 1

Related Questions