How add a toggle button for active inactive in Yii CGridView
<?php $this->widget('zii.widgets.grid.CGridView', array(
'id'=>'subject-grid',
'dataProvider'=>$model->search(),
'columns'=>array(
'id',
'subjectName',
array(
'header'=>'Status',
'class'=>'CButtonColumn',
'template'=>'{activate} {rejected}',
'buttons'=>array(
'activate'=>array(
'label'=>'<img src="'.$publishImageUrl.'">',
'visible'=>'$data->status==1',
'url'=>'Yii::app()->createUrl("subject/changestatus",array("id"=>$data->id,"status"=>0))',
'options'=>array('confirm'=>'Are you sure want to unpublish?'),
),
'rejected' =>array(
'label' =>'<img src="'.$unpublishImageUrl.'">',
'visible'=>'$data->status==0',
'url'=>'Yii::app()->createUrl("subject/changestatus",array("id"=>$data->id,"status"=>1))',
'options'=>array('confirm'=>'Are you sure want to Publish?'),
),
),
),
),
)); ?>
when user click on button a confirm message will come
0 Comment(s)