CGridView problem

I am using the CGridView to view the cats table and I have an array $acts(1=>‘active’,0=>‘unactive’).

So I set this but it does not work, what is wrong? (cat_active has values 1,0 )


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

	'dataProvider'=>$dataProvider,

	'columns'=>array(		

		'cat_tittle',

		array('name'=>'cat_active','value'=>$acts[$data->cat_active]),

		

		array(

			'class'=>'application.components.ButtonColumn',

		),

	),

));

try this:


array('name'=>'cat_active','value'=>'$acts[$data->cat_active]'),

[not tested]

Now nothing is shown at this attr , I thing because I use an array.

When I set $acts[1] I see the ‘active’ , something is wrong with $data->cat_active

I solved similar problem with a function…

before calling CGridView make a function like:




function getStatus($id)

{

   $acts(1=>'active',0=>'unactive');

   return $acts[$id];

}



then in the call to CGridView use:




...

'cat_tittle',

array('name'=>'cat_active','value'=>'getStatus($data->cat_active)'),

...



Very strange but it works.