I want to make my action column button as dropdown button in my gridview, this is my code
// ... GridView configuration ...
['class' => 'yii\grid\ActionColumn',
'template' => '{sell} {delete}',
'buttons' => [
'sell' => function ($url, $model) {
return Html::a('<button type="button" class="btn btn-success"><i class="glyphicon glyphicon-shopping-cart"></i></button>', $url, [
'title' => Yii::t('app', 'Sell Tickets'),
'data-toggle' => "modal",
'data-target' => "#myModal",
'data-method' => 'post',
]);
},
'delete' => function ($url, $model) {
return Html::a('<button type="button" class="btn btn-danger"><i class="glyphicon glyphicon-remove-sign"></i></button>', $url, [
'title' => Yii::t('app', 'Delete'),
'data-toggle' => "modal",
'data-target' => "#myModal",
'data-method' => 'post',
]);
},
],
'urlCreator' => function ($action, $model, $key, $index) {
if ($action == 'sell') {
$url = Url::toRoute(['trip/sell', 'id' => $model->tripScheduleId]);
return $url;
} else {
$url = Url::toRoute(['trip/delete', 'id' => $model->tripScheduleId]);
return $url;
}
},
],
and this is the view
I've followed many in so or any source but nothing work on me.