Css And Cgridview

Hello there,

I need to add css to the cell depending to their values(red color, green color,…).

I am using this but it works only with one condition.


 array(

        'header' => 'Status',

        'name' => 'status',

        'value' => '$data->status',

        'cssClassExpression' => '$data->status == "Published"? "published-file" : ""',

      // 'cssClassExpression' => '$data->status == "Rejected"? "rejected-file" : ""',

//        'cssClassExpression' => '$data->status == "Pending Authorization"? "pending-file" : ""',

//        'cssClassExpression' => '$data->status == "Corrected"? "corrected-file" : ""',

    ),

Call a function in cssClasExpression value as:




 'cssClassExpression' => 'changeCss($data->status)',



and define function like this




function changeCss($status){

 /*

       Now handle conditons here and return them;

*/

}



Thank you Absar, it works!

thanks Absar !!