Yii:: Highlight row color in CGridView using rowCssClassExpression

Posted: February 15, 2014 in Php, Yii Framework
Tags: , ,

If you’re using CGridView and want to highlight or focus on certain row, you can use rowCssClassExpression attribute in your gridview.

Here is the working method that works with combine even/odd class.

$this->widget('zii.widgets.grid.CGridView', array(
        'rowCssClassExpression'=>'($data->cancel_status == "Y")? "cancel" : "row_id_" . $row . " " . ($row%2?"even":"odd")',

Thanks to willowdan in forum http://www.yiiframework.com/forum/index.php/topic/11834-how-do-i-combine-rowcssclassexpression-with-oddeven/


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s