I would like to overload only some buttons in the action columns, but when I try to do this, the default button does not work
<?= GridView::widget([ 'dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'columns' => [ (...) [ 'class' => 'yii\grid\ActionColumn', 'headerOptions'=> ['style'=>'width: 70px;'], 'template' => '{view} {update} {delete}', 'buttons' => [ 'view' => function ($url, $model) { (...) }, 'update' => function ($url, $model) { (...) } ], 'urlCreator' => function ($action, $model, $key) { if ($action === 'view') { (...) } else if ($action === 'update') { (...) } } ], ], ]); ?>
Using the code above, the delete action does not work, the generated code:
<a title="Elimina" aria-label="Elimina" data-confirm="...?" data-method="post" data-pjax="0"> <span class="glyphicon glyphicon-trash"> </span> </a>
So, the delete action is not sent, and the index page is reloaded,
Can you help me?
fabio source share