Hello, I have a CGridView and one of the columns has a dropdown list as a filter for an attribute that is a relation. The relation is:
'engine' => array(self::BELONGS_TO,'Engines','eid','order'=>'name'),
And the CGridView column looks like this:
array(
'name' => 'eid',
'header' => 'Engine',
'filter' => CHtml::listData($engines, 'id', 'name'),
'value' => '$data->engine->name',
),
The filter is a drop down list of all of the engines. This works just fine, but my problem is that I want to filter the column by name (engine.name) and not id (eid or engine.id). I want to be able to select an engine from the drop down list and then it filters the CGridView by that engine name and not its id. I tried changing the code to:
array(
'name' => 'eid', //or 'name' => 'engine.name'
'header' => 'Engine',
'filter' => CHtml::listData($engines, 'name', 'name'),
'value' => '$data->engine->name',
),
but either the filter drop down completely disappears or it just plain doesn’t work. Any help is appreciated, thanks.