hello guys,
I was wondering whether its possible to check a condition in the cbutton column.
The code part is as follows :
array(
'class' => 'CButtonColumn',
'header' => '',
'htmlOptions' => array('class' => 'width110'),
'headerHtmlOptions'=>array('class' => 'width110'),
'template' => '($data->weblinkId) ==1 ? {edit} : {delete}',
'buttons' => array(
'edit' => array(
'label'=>'', // text label of the button
'url'=>'Yii::app()->createUrl("user/editweblink", array("id"=>$data->weblinkId))', // the PHP expression for generating the URL of the button
'visible' => '$data->weblinkId',
'options'=>array('class'=>'profile-edit-btn'), // HTML options for the button tag
),
'delete' => array(
'label'=>'', // text label of the button
'url'=>'Yii::app()->createUrl("user/removeweblink", array("id"=>$data->weblinkId))', // the PHP expression for generating the URL of the button
'visible' => '$data->weblinkId',
'deleteConfirmation'=>'Are you sure you want to delete this record',
'options'=>array('class'=>'delete-btn'), // HTML options for the button tag
),
),
),
Is something similar like this possible or is there any other way which i can get this done?
'template' => '($data->weblinkId) ==1 ? {edit} : {delete}',
Cheers.