dgtal
September 17, 2014, 4:30pm
1
Hi. I have this model with a relation and i’m displaying it with a cgridview.
Inside my cdbcriteria i have this condition:
IF(DATE_FORMAT(rap.month, '%m') = DATE_FORMAT(t.installation_date, '%m'), 1, 0) AS done
Mysql generates the "done" field with the value of 1 or 0.
Now, how can i display this value in the cgridview?
Bizley
(Bizley)
September 18, 2014, 6:10am
2
I’ve never done this in Yii but does this work?
$this->widget('zii.widgets.grid.CGridView', array(
// ...
'columns' => array(
array(
'header' => 'Done',
'value' => '$data->done',
),
),
));
dgtal
September 18, 2014, 7:15am
3
dgtal:
Hi. I have this model with a relation and i’m displaying it with a cgridview.
Inside my cdbcriteria i have this condition:
IF(DATE_FORMAT(rap.month, '%m') = DATE_FORMAT(t.installation_date, '%m'), 1, 0) AS done
Mysql generates the "done" field with the value of 1 or 0.
Now, how can i display this value in the cgridview?
Ok, i found the solution. Simply using ‘done’ as a column will work, but you will need to add the ‘done’ property to the model (right after the class starts, you add ‘public $fatto;’ )