を実装してkartik dynagrid
いますが、変数のみを渡す必要があるというエラーが発生します。
これは私が試したコードです:
列
<?php
$columns = [
'id',
'username',
'first_name',
'other_names',
'email',
[
'class' => ActionColumn::className(),
'header' => 'Roles',
'template' => '{assign-roles}',
'buttons' => [
'assign-roles' => function ($url, $model, $key) {
return Html::a("Assign Role", $url);
}
]
],
[
'class' => ActionColumn::className(),
'header' => 'Action',
'buttons'=>[
'delete'=>function($url, $model, $key){
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 ?'.
'We recommend deactivating the user to avoid inconcistencies with the data this user handled'),
'data-method' => 'post',
]);
}
]
]
];
これはgrid
echo DynaGrid::widget([
'columns' => $columns,
'showPersonalize' => true,
'options' => ['id' => 'dynagrid-users'],
'gridOptions' => [
'dataProvider' => $dataProvider,
'pager' => [
'firstPageLabel' => 'First',
'lastPageLabel' => 'Last',
'maxButtonCount' => 10,
],
'panel' => [
'heading' => '<h3 class="panel-title"><i class="glyphicon glyphicon-book"></i> All Users</h3>',
'before' =>
'<i>* All Users in the database</i><br>',
//'after'=>Html::a('<i class="glyphicon glyphicon-repeat"></i> Reset Grid', ['index'], ['class' => 'btn btn-info']),
'footer' => true
],
'toolbar' => [
['content' => '{dynagridFilter}{dynagridSort}{dynagrid}'],
'{export}',
'{toggleData}'
],
'pjax' => true,
'bordered' => true,
'striped' => true,
'condensed' => true,
'responsive' => true,
'responsiveWrap' => false,
]
]);
?>
変数のみを参照渡しする必要があるというエラーが常に表示されます。