I have list of files.
In array data provider i have fields: approved, filename, uploaded etc.
I want to add css class bold to cell filename, but with condition if approved == 1.
This is part of my view
$this->widget('zii.widgets.grid.CGridView', array(
'dataProvider' => $provider,
'filter' => $model,
'columns' =>
array(
array(
'name' => 'file_name',
'header' => 'Filename',
'filter' => '',
'htmlOptions' => array(
'class' => ($data['approved']) ? (1) : (0)
),
),
I can use $data[‘approved’] in value, but not in htmlOptions.
What you are looking for is http://www.yiiframework.com/doc/api/1.1/CGridColumn#cssClassExpression-detail