B
B
bizzonaru2016-08-15 10:36:08
Yii
bizzonaru, 2016-08-15 10:36:08

How in a regular gridview when using select2 to change query get call when enter is pressed instead of selecting value from select2 list?

There is a standard Yii2 GridView where Select2::widget is used in the filter

[
                'label' => 'Авторы',
                'attribute' => 'authorids',   
                'format' => 'html',
                'filter' => Select2::widget([
                    'name' => 'authorIds',  
                    'data' => Authors::find()->addSelect(["CONCAT(firstname, ' ', lastname) AS fullname", "id"])->indexBy('id')->column(),
                    'options' => [
                        'placeholder' => 'Выберите автора ...',
                        'multiple' => true, 
                    ],
                    'pluginOptions' => [
                        'allowClear' => true
                    ],
                ]),
            ],

How in this case to change the automatic get request not when choosing a value from the list, but when pressing enter?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dmitry, 2016-08-15
@slo_nik

Look at the Select2 sources, understand how it works and override the desired method.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question