A
A
Alexander2020-08-26 13:57:41
Yii
Alexander, 2020-08-26 13:57:41

How in Yii2 Select2 to display predefined options in select before calling AJAX search?

Hello.
There was a question concerning Yii2 and Select2+AJAX. I looked at the documentation, I didn’t find anything similar, and I don’t really want to do crutches.

How can I substitute predefined options in the select before calling the Select2 lookup AJAX?

Suppose we display cities in the view. There are 5k+ in the database.
It is necessary to display several large cities before searching for a city and then replace them with search results if we enter letters in the field.

5f46404c7494a560564821.jpeg

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexander, 2020-08-27
@tomclancys

Should have been added to 'pluginOptions' => 'tokenSeparators' => [',', ' '],

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question