yii2 在 gridview 中更改控制器操作 [英] yii2 change controller action in gridview
本文介绍了yii2 在 gridview 中更改控制器操作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有 ItemController 并在 actionView 中放置了我的 Itempicture 的 gridview,我希望当我点击图标视图时,更新和删除然后转到 ItempictureController.
那么如何使用不同的控制器更改 gridview 中的控制器操作?
解决方案
在你的 gridview 中,添加喜欢
<预><代码>['类' =>'yiigridActionColumn','模板' =>'{new_action1}{new_action2}','按钮' =>['new_action1' =>函数($url,$model){return Html::a('<span class="glyphicon glyphicon-eye-open"></span>', 'controller/action?id='.$model->id, ['标题' =>Yii::t('app', 'New Action1'),]);}],],希望这会奏效!
I have ItemController and in actionView I put gridview of my Itempicture, and I want when I click on icon view, update and delete then go to ItempictureController.
so How to change controller action in gridview with different controller?
解决方案
In your gridview,add like
[
'class' => 'yiigridActionColumn',
'template' => '{new_action1}{new_action2}',
'buttons' => [
'new_action1' => function ($url, $model) {
return Html::a('<span class="glyphicon glyphicon-eye-open"></span>', 'controller/action?id='.$model->id, [
'title' => Yii::t('app', 'New Action1'),
]);
}
],
],
Hope this will work!
这篇关于yii2 在 gridview 中更改控制器操作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文