CGridView, search related table

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;




View Admin

<?php $this->widget('zii.widgets.grid.CGridView', array(








            'name' => 'country',

            'value' => '$data->country->country',









)); ?>

There’s a wiki for it

@bennouna thank you! I forgot to add country to the safe on search rule…

array('country', 'safe', 'on'=>'search'),