I have a grid view that lists contents of a table, table has column author_id.
Now I’m displaying usernames using relation name column syntax author.username.
Is it possible to allow user to type in a username in column filter, with support of CJuiAutoComplete, some examples hints?
My code sample:
<?php $this->widget('zii.widgets.grid.CGridView', array(
'dataProvider'=>$model->with('author')->search(),
'filter'=>$model,
'columns'=>array(
// ...
array(
'name'=>'author.username',
'filter'=> // ?
),
// ...
),
));
The widget has a 3rd parameter that can be set to true which means that will return a string and will not render the widget CJuiAutoComplete.
and $array_params can be replaced with similar as following ex :
and also you have to put in your model search method some checks :