Is there any good Samaritan who tells me how to add an icon to the Action Column and where can I find a list of these?
Maybe the list of icons could be this…
http://glyphicons.bootstrapcheatsheets.com/
Ok, I got it:
<?= GridView::widget([
'dataProvider' => $dataProvider,
'filterModel' => $searchModel,
'columns' => [
['class' => 'yii\grid\SerialColumn'],
'id',
...
[
'class' => 'yii\grid\ActionColumn',
'template' => '{view}{update}{delete}{my_button}',
'buttons' => ['my_button' => function ($url, $model) {
return Html::a('<span class="glyphicon glyphicon-pushpin"></span>', $url, [
'title' => Yii::t('app', 'My Button'),
]);
}],
],
],
]); ?>
Now I must understand where to associate the code. I don’t need click to a link, but to an sql function.
It is possible to run a sql code (copy the corresponding record from the table to another) when clicking on the new MyButton ?
I answer to myself. Yes, it is. The button can run an action in the controller. I think.