Hi all,
i want to use MyCButtonColumn in my view.php file for using templates…
by default it gives 3 buttons view,update & delete…but i want to display only update and delete button…
i have used MyCButtonColumn in yii 1.10 and but in yii2 dun knw…
please provide solution…
Thanks.
Try the following code snippet:
<?php $this->widget(‘zii.widgets.grid.CGridView’, array(
'id'=>'individual-grid',
'dataProvider'=>$model->search(),
'filter'=>$model, // comment this line to remove filters from grig view
'columns'=>array(
'tablecol1',
'tablecol2',
'tablecol3',
array(
'class'=>'CButtonColumn',
'template'=>'{delete} {update}',
)
)
)); ?>
Thanks S@ndy,
i have done my code as
['class' => 'yii\grid\ActionColumn',
'template' => '{update}{delete}',
'controller' => '/batch',
'urlCreator' => function ($action, $model, $key, $index) {
if ($action == 'update') {
return $url = \Yii::$app->getUrlManager()->createUrl("batch/update?id=".$model->batch_id."&course=".$_REQUEST['id']);
}
}
],
it works proper…
Thanks for the reply.