To jest przykład jak można dodać przyciski:
[
'class' => 'yii\grid\ActionColumn',
'context' => $this->context,
'buttons' => [
'edit' => function ($model, $key, $index, $instance) {
$urlConfig = [];
foreach ($model->primaryKey() as $pk) {
$urlConfig[$pk] = $model->$pk;
$urlConfig['type'] = $model->type;
}
$url = Url::toRoute(array_merge(['modify'], $urlConfig));
return Html::a('<span class="glyphicon glyphicon-pencil"></span>',
$url, [
'title' => \Yii::t('yii', 'Update'),
'data-pjax' => '0',
]);
},
'remove' => function ($model, $key, $index, $instance) {
$urlConfig = [];
foreach ($model->primaryKey() as $pk) {
$urlConfig[$pk] = $model->$pk;
$urlConfig['type'] = $model->type;
}
$url = Url::toRoute(array_merge(['delete'], $urlConfig));
return Html::a('<span class="glyphicon glyphicon-trash"></span>',
$url, [
'title' => \Yii::t('yii', 'Delete'),
'data-confirm' =>
\Yii::t('yii', 'Are you sure to delete this item?'),
'data-method' => 'post',
'data-pjax' => '0',
]);
}
],
'template' => '{edit}{remove}'
],
znalazłem alternatywne podejście do niego: [ \t \t \t 'klasa' => 'Yii \ siatki \ ActionColumn', \t \t \t 'template' => '{widok} {aktualizacja} {} {usuwać klienci-wiza/tworzyć} {klienci-wiza /}', 'przyciski' \t \t \t => [ \t \t \t \t 'klientów/tworzyć' => function ($ url) { \t \t \t \t \t powrót HTML :: a ( \t \t \t \t \t \t \t „ ” \t \t \t \t \t \t \t $ url, \t \t \t \t \t \t \t [ \t \t \t \t \t \t \t 'TYTUŁ' => 'kliencki' \t \t \t \t \t \t \t 'danych pjax' => '0', \t \t \t \t \t \t \t ] \t \t \t \t \t); \t \t \t \t} \t \t \t \t ... \t \t \t] \t \t] – Humbal
zamieścić tego rozwiązania jako odpowiedź, będziemy głosować go – Imtiaz