At the moment i'm using a cgridview (Yii) to display a lunch and the users of this lunch. The users are stored in JSON in the database and i'm wondering how to display this decoded with the same view as the rest of my table.
The code is:
<?php $this->widget('zii.widgets.grid.CGridView', array(
'id'=>'lunch-grid',
'dataProvider'=>$model->search(),
'filter'=>$model,
'columns'=>array(
'id',
'date',
'cook',
'food',
'price',
'users',
array(
'class'=>'CButtonColumn',
),
),
)); ?>
I was thinking about something like this, but then the filter field at the top disappears...
<?php $this->widget('zii.widgets.grid.CGridView', array(
'id'=>'lunch-grid',
'dataProvider'=>$model->search(),
'filter'=>$model,
'columns'=>array(
'id',
'date',
'cook',
'food',
'price',
array( 'header' =>'Users',
'type'=>'raw',
'value'=> 'implode(", ", CJSON::decode($data->users))',
),
array(
'class'=>'CButtonColumn',
),
),
)); ?>
How can i solve this?