Search box in Column CGridData

Hi, I have a question.

I have a GriData showing a table that has a FK to another table.

like: invoice->customer.

So I made this on GridView definition:


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

	'id'=>'cuotas-grid',

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

	'filter'=>$model,

	'columns'=>array(

		'id',

//		'socio_id',

		'per_anio',

		'per_mes',

		array('type'=>'raw', 'name'=>'socio.apellidoynombre','value'=>'CHtml::link($data->socio->apellidoynombre, array("socio/view","id"=>$data->socio->id));'),

		'per_importe',

		'observaciones',

		/*

		'creado_at',

		'creado_by',

		*/

		array(

			'class'=>'CButtonColumn',

		),

	),

)); ?>



the column : socio.apellidoynombre is the FK attribute defined in the model "Cuota";


	public function relations()

	{

		// NOTE: you may need to adjust the relation name and the related

		// class name for the relations automatically generated below.

		return array('socio'=>

			array(self::BELONGS_TO, 'Socio', 'socio_id')

		);

	}



In the grid the data shows perfect.

But I LOST the filter box !! in the column header.

And I lost it also on the Advanced Search form …

Any sugestion ??

Best Regards.

Nicolas

Hi, following an interesting Guide in spanish I found that is achieved with:


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

	'id'=>'cuotas-grid',

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

	'filter'=>$model,

	'columns'=>array(

		'id',

//		'socio_id',

		'per_anio',

		'per_mes',

		//array('header'=>'Apellido y Nombre','name'=>'socio_id','value'=>'$data->socio->apellidoynombre'),

		array('header'=>'Apellido y Nombre','type'=>'raw', 'name'=>'socio_id','value'=>'CHtml::link($data->socio->apellidoynombre, array("socio/view","id"=>$data->socio->id));'),

		'per_importe',

		'observaciones',

		/*

		'creado_at',

		'creado_by',

		*/

		array(

			'class'=>'CButtonColumn',

		),

	),

));

Where the diference is ‘name’ atribute in column array !

Regards