Reputation: 6639
I have a dynagrid and add an extra column in the dynagrid but it doesnt work. I have tried:
<?php
$columns = [
['class' => 'yii\grid\SerialColumn',],
'officename',
[
'class' => ActionColumn::className(),
'header' => 'Units',
'template' => '{add-units}',
'buttons' => [
'assign-roles' => function ($url, $model, $key) {
return Html::a("Add Units", $url);
}
]
],
];
echo DynaGrid::widget([
'columns' => $columns,
'showPersonalize' => true,
'options' => ['id' => 'dynagrid-users'],
'gridOptions' => [
'dataProvider' => $dataProvider,
'pager' => [
'firstPageLabel' => 'First',
'lastPageLabel' => 'Last',
'maxButtonCount' => 10,
],
'pjax' => true,
'bordered' => true,
]
])
?>
The add units doesnt display the words (Add Units) what could be wrong
Upvotes: 0
Views: 364
Reputation: 1417
You customized your Action Column template and gave a new column add-units
but you gave a different name under button options assign-roles
. Both should be same
[
'class' => ActionColumn::className(),
'header' => 'Units',
'template' => '{add-units}',
'buttons' => [
'add-units' => function ($url, $model, $key) {
return Html::a("Add Units", $url);
}
]
],
Upvotes: 2