Reputation: 3151
Before I have used comboBox instead of default(textBox) for searching in the gridview by using this one:
[
'attribute' => 'project_status',
'filter' => $someArray,
'value' => 'projectstatus.name',
]
But I want to change from comboBox to autocomplete textBox so the search function is still working.
Upvotes: 4
Views: 3619
Reputation: 1274
You can actually set an AutoComplete widget as the filter. The following code works for me:
[
'attribute' => 'project_status',
'filter' => AutoComplete::widget([
'model' => $filterModel,
'attribute' => 'project_status',
'clientOptions' => [
'source' => ['USA', 'RUS'],
],
]),
'value' => 'projectstatus.name'
]
Although you may have to tweak it a little for proper search to happen upon selecting a value.
Upvotes: 5