Cgridview conditional display problem

My problem is something like this:

I have a table with fields "from_time" and "to_time" which accepts entries "time" type to display hours. Values are coming into the table through dropdown list of general hours including a value "closed". I am displaying all the data through cgridview. Now when someone selects "closed" from the dropdown and save the data, "closed" is saved as "00:00:00". How can i display "closed" when i am displaying the data through cgridview?

Any help is appreciated.

You can use anonymous function in php.






return $data==='00:00:00' ? 'closed' : $data;





anonymous function works from PHP 5.3 on

you can do it even without them

'value'=>'$data=="00:00:00" ? "closed" : $data',

Thanks a lot! Works for me.

Gracias, it works perfect. Just what I needed.