Thursday, 18 December 2014

Yii:: Highlight row color in CGridView using rowCssClassExpression

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(
    'id'=>'leave-form-grid',
    'dataProvider'=>$model->approve()->search(),
    'filter'=>$model,
        'rowCssClassExpression'=>'($data->cancel_status == "Y")? "cancel" : "row_id_" . $row . " " . ($row%2?"even":"odd")',
    'columns'=>array(
        //'id',
        'staff_id',
                'staff.name',

No comments:

Post a Comment