Specifying a custom filtering for a relational column in a CGridView

I’m using a CGridView generated by Gii’s CRUD generator, and customized one of the columns to show a related model’s attribute.

What happened is that the ability to filter by that column is now gone. (In the example: Venue)

How can I specify a way to filter the column?

I’d prefer to build a <select> with possible options, but a string filter would be fine too.


// $model is an Event, which BELONGS_TO Venue.

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

	'id'=>'event-grid',

	'dataProvider'=>$model->search(),

	'filter'=>$model,

	'columns'=>array(

		'id',

		'datetime',

		'text',

		'Venue.name', // <-- this one. originally was 'venue' I.E. Event's foreign key pointing to venues.

		array(

			'class'=>'CButtonColumn',

		),

	),

));

Hi, petruza,

I’d like to recommend you to read this wiki.

http://www.yiiframework.com/wiki/281/searching-and-sorting-by-related-model-in-cgridview/