我想将ActionColumn的按钮视图的目标更改为同一数据库中的不同表

时间:2016-06-24 07:43:48

标签: php yii2

我想将ActionColumn按钮视图的目标更改为同一数据库中的不同表格...

<?= GridView::widget([
    'dataProvider' => $dataProvider,
    'filterModel' => $searchModel,
    'columns' => [
        ['class' => 'yii\grid\SerialColumn'],

       // 'id',
        'nama_siswa',
        'bahasa_indonesia',
        'bahasa_inggris',
        'matematika',
         'kejuruan',

        ['class' => 'yii\grid\ActionColumn'],
    ],

]); ?>

1 个答案:

答案 0 :(得分:0)

您可以将view按钮网址更改为: - 指向另一个操作控制器或网址

ActionColumn装饰器更改为: -

<?= GridView::widget([
'dataProvider' => $dataProvider,
'filterModel' => $searchModel,
'columns' => [
    ['class' => 'yii\grid\SerialColumn'],

   // 'id',
    'nama_siswa',
    'bahasa_indonesia',
    'bahasa_inggris',
    'matematika',
    'kejuruan',
    [
       'class' => 'yii\grid\ActionColumn',
       'buttons' => [
           'view' => function(){
                    return Html::a('<span class="glyphicon glyphicon-eye-open"></span>', ['/other-controller/action'], []);
                }
            ]
        ],
    ],

]); ?&GT;