Remove / Disable the button "Update" in the CGridView

Hello everyone,

I want to remove or disable the button "Update" when displaying records in the CGridView after checking a condition.

I could not send the ID of the invoice(Facture) to the function "verifEtatFacture".

I tried the following :




array(

      'class'=>'CButtonColumn',

      'updateButtonOptions'=>array('onClick'=>'verifEtatfacture($.fn.yiiGridView.getSelection(id))'),

),



And This :




array(

      'class'=>'CButtonColumn',

      'updateButtonOptions'=>array('onClick'=>'verifEtatfacture($data->FactureID)'),

),



Have you a solution?

Thank you.

Have you tried with the visible option of the buttons property - http://www.yiiframework.com/doc/api/CButtonColumn#buttons-detail

Thank you mdomba, your solution works :)




               array(

                    'class'=>'CButtonColumn',

			'template'=>'{update}{view}{delete}',

			'buttons'=>array(

					'update'=>array(

							'visible'=>'$data->TotalPaye || $data->TransfertCompta',

						),

					'view'=>array(

							'visible'=>'true',

						),

					'delete'=>array(

							'visible'=>'true',

						),

			),

               ),



Glad you solved it…

For view and delete you don’t need to set visible=true, it’s by default… but I suppose you wrote it because you are thinking to put even here some conditions later on…

yes, exactly