dynamic color in CGridView

I have been using many tables having, say, warning column painted by pink colour. For example, in terms of the schedule, there may be the column of due date, and if the due date expires, task name column should be coloured by pink as a warning.

On the other hand, CGridView seems to have the dynamic value as the doc show as follows, though the attribute of the column (htmloptions) doesn’t seem to be a dynamic function.

       array(            // display 'create_time' using an expression


            'value'=>'date("M j, Y", $data->create_time)',


Is there way to have a dynamic attribute of the column? For example, I would like to do as follows.






function certain_function($otherColumn)


      if ($otherColumn == '<img src='http://www.yiiframework.com/forum/public/style_emoticons/default/huh.gif' class='bbc_emoticon' alt='???' />?') {

          return array('class'=>'b1');


          return array('class'=>'b2');



In short, I would like to paint some columns according to the contents of the other column.

For a row you can use rowCssClassExpression - http://www.yiiframework.com/doc/api/1.1/CGridView#rowCssClassExpression-detail

and for a column there is cssClassExpression - http://www.yiiframework.com/doc/api/1.1/CGridColumn#cssClassExpression-detail

Thanks mdomba, I will try those properties!