How to use the Gridview to search in a related table? When i type in a country name en pres enter nothing will change. When i filter on a field within the model it wil show the corresponding items.
In my case i try to search on a country name when i’m in the City/Admin page.
Thank you in advanced.
Model City:
$criteria=new CDbCriteria;
$criteria->with=array('country');
$criteria->compare('id_city',$this->id_city);
$criteria->compare('country.country',$this->country);
View Admin
<?php $this->widget('zii.widgets.grid.CGridView', array(
'id'=>'city-grid',
'cssFile'=>'/css/admin/gridview.css',
'dataProvider'=>$model->search(),
'filter'=>$model,
'columns'=>array(
'id_city',
array(
'name' => 'country',
'value' => '$data->country->country',
),
'province',
'municipality',
'city',
array(
'class'=>'CButtonColumn',
),
),
)); ?>