Answer the question
In order to leave comments, you need to log in
Why does the AutoComplete widget return the entire list of options?
The AutoComplete widget used in the GridView filter, when an external source is connected, returns the complete list of options, regardless of what the user enters.
If you directly specify an array in source, it works correctly. What could be wrong?
Widget connection:
'filter' => AutoComplete::widget([
'model' => $searchModel,
'attribute' => 'City',
'clientOptions' => [
'source' => Url::toRoute('columnautocomplete'),
],
'options' => ['class' => 'form-control'],
]),
public function actionColumnautocomplete() {
return Json::encode(Phones::find()
->select(['City as label'])->distinct()
->asArray()
->all());
}
Answer the question
In order to leave comments, you need to log in
And what do you think it should produce if you do not impose any restrictions when selecting options on the server?
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question