// Comment [ 'class' => 'yii\grid\ActionColumn', 'contentOptions' => ['style' => 'width:260px;'], 'header'=>'Actions', 'template' => '{view} {delete}', 'buttons' => [ //view button 'view' => function ($url, $model) { return Html::a('View', $url, [ 'title' => Yii::t('app', 'View'), 'class'=>'btn btn-primary btn-xs', ]); }, ], 'urlCreator' => function ($action, $model, $key, $index) { if ($action === 'view') { $url ='/jobs/view?id='.$model->jobid; return $url; } } ],Source and discussion
Another sample:
// Comment ['class' => 'yii\grid\ActionColumn',
'template' => '{update} {delete}',
'buttons' => [
'delete' => function ($url, $model, $key) {
if ($model->fk_status_id == 1) {
return Html::a('<span class=\'glyphicon glyphicon-trash\'></span>', $url, ['data-pjax' => 0, 'data-method' => 'post', 'data-confirm' => 'Are you sure you want to delete this item?', 'aria-label' => 'Delete', 'title' => 'Delete']);
}
},
],
],
The second one works. Thank you!!!
ReplyDeleteYou are welcome, unfortunately I am not having much time to post but hopefully I will publish more content. Happy that it was useful to someone.
Deletethank you dude
ReplyDelete