mpluss
(Mahdi Mastouri)
October 1, 2010, 8:17am
1
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.
mdomba
(Maurizio Domba Cerin)
October 1, 2010, 9:03am
2
Have you tried with the visible option of the buttons property - http://www.yiiframework.com/doc/api/CButtonColumn#buttons-detail
mpluss
(Mahdi Mastouri)
October 1, 2010, 1:32pm
3
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',
),
),
),
mdomba
(Maurizio Domba Cerin)
October 1, 2010, 1:44pm
4
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…