Hi
I have code:
<?php $this->widget('zii.widgets.grid.CGridView', array(
'id'=>'business-grid',
'dataProvider'=>$model->search(),
'filter'=>$model,
'columns'=>array(
'id',
'active',
array(
'name'=>'active',
'header'=>'Status',
'type' => 'html',
'value'=>($data->active=1)?'Active':'Unactive',
)
...
?>
active has values 0 and 1. In first column after id I display active as 0 or 1. It works ok. In another column I want to put status text (Active or Unactive) name based on active value. I wanted to use short if statement
'value'=>($data->active=1)?'Active':'Unactive',
but it gives me Active all the time. Where is the trick here?
This did the trick:
'value'=>'$data->active?\'Active\':\'Unactive\'',