$data in CGridView don't show the value !

Hi, I have a CGridView with some columns,

I added a CGridColumn to the existing one, because I want a special column for my actions.

The problem is that the special variable $data doesn’t retrive any value, except for “id” field !

this is my code:




		array(

			'class' => 'CButtonColumn',

			'header' => Yii::t('app','Generar'),

			'template'=>'{generate}',

			'buttons'=>array(

				'generate' => array(

			            'label'=>$data->mes_calendario.Yii::t('app','Generar Cuota Mes '.$row[1]),

			            'imageUrl'=>Yii::app()->request->baseUrl.'/images/money.png',

			            'url'=>'Yii::app()->createUrl("cuota/generate", array("def_cuota"=>$data->id))',

			        ),


			    ),

		),




It supose that $data->mes_calendario should return a value, I have this attribute as a column in the Grid and works fine.

Also the URL option work perfect, so I get the url with the paranmeters.

I have several (3) CButtonColumns in the grid .

That could be a problem ?

What I’m doing wrong ?

$data->mes_calendario is in the grid:


	'columns' => array(

		//'fkCuotaDefAnual',

		'descripcion',

		//'mes_calendario',

		array('name'=>'mes_calendario','htmlOptions'=>array('style' => 'text-align: center;')),

		array('name'=>'tipo_cuota','htmlOptions'=>array('style' => 'text-align: center;')),

Only some of the members of the CButtonColumn buttons array will take a PHP expression for later evaluation row by row.

You may want to extend CButtonColumn. One example here, looking for a better one. Couldn’t find it.

It goes something like this




class ButtonColumn extends CButtonColumn

{

  protected function renderButton($id,$button,$row,$data)

  {

    if (isset($button['label']))

      $button['label'] = $this->evaluateExpression(

        $button['label'],

        array('row'=>$row,'data'=>$data)

      );

    parent::renderButton($id,$button,$row,$data);

  }

}



s[/s] (worked for me)

Name the file the same as the class and store in protected/components. Remember to specify the extended class name in the grid.

/Tommy