Problem with CCheckBoxColumn visible property

Hi guys.

This is my CCheckBoxColumn on cgridview:






  'visible'=>'$data->aceite=="S"? false:true',


But the checkbox always get visible. To prove that my data "$data->status_registro" shows correct information, My rowCssClassExpression works perfectly:

'rowCssClassExpression'=>'$data->aceite =="S" ? "gone ". ($row%2 ? "even" : "odd") : ($row%2 ? "even" : "odd")', 

What i’m doing wrong?


The ‘visible’ value can’t be evaluated

Could it be that ‘visible’ is always being evaluated as true? Change your condition to <> to see if it changes.

Yes. The visible property can be evaluated.

This other code in my application works perfectly:




        'template' => '{update}',


        'buttons' => array(


	'update' => array(

                         'visible'=>'$data->status_registro=="I"? false:true',






	data = $(this).parent().parent().children(".dataregistro").text();

	var hora = $(this).parent().parent().children(".hora").text();

	var justificativa = $(this).parent().parent().children(".justificativa").text();

	var hora_retificada = $(this).parent().parent().children(".hora_retificada").text();








But the same idea “‘visible’=>’$data->status_registro==“I”? false:true’,” does not work on CCheckBox Column and i dont know why.

Same thing :mellow:

Someone? :-[

By documentation the visible property is "boolean" and is not validated -

In the other example you gave above "visible" is the option of the buttons definition and that one is a PHP expression that is evaluated -

I think you can make use of ‘cssClassExpression’ property to control the visibility of the checkbox.






  'cssClassExpression'=>'$data->aceite == "S" ? "hidden" : ""',


Thank you very much for your reply softark but it did not work.

The field CCheckBoxColumn still visible. If I can at least disable it like disabled = false, it perfectly fits me.

Have you added an entry for ".hidden" class in your css?

I’m sorry softdark. I had understood that the property was a hidden css not a css class. It worked beautifully, thanks you very much!

humm I am sorry for the question(css aie aie), but how do you write in your file css the rule coresponding to :

class="checkbox-column hidden"

Because when I use :

‘cssClassExpression’=>’$data->aceite == “S” ? “hidden” : “”’,

that renders :

class="checkbox-column hidden"



Normally you just have to add the following in your own css file

.hidden {

    display: none;


You can ignore "checkbox-column" class which the CCheckBoxColumn will add to the cell.

class="checkbox-column hidden"

means that the element has "checbox-column" class AND "hidden" class. So the element will have the cumulative styles of ".checkbox-column" AND ".hidden".