小编TaN*_*N3L的帖子

Yii2 pjax gridview ActionColumn问题与视图链接

我试图在索引中创建自定义操作列并编写此代码:

     [  
            'class' => 'yii\grid\ActionColumn',
            'contentOptions' => ['style' => 'width:50px;'],
            'header'=>'',
            'template' => '{view} {update}',
            'buttons' => 
            [

                //view button
                'view' => function ($url, $model) {
                    return Html::a('<span class="glyphicon glyphicon-eye-open"></span>', $url, [
                                'title' => Yii::t('app', 'View'),                              
                    ]);
                },
                'update' => function ($url, $model) {
                    if (Yii::$app->user->can('change-offer')) 
                    {
                        return Html::a('<span class="glyphicon glyphicon-pencil"></span>', $url, [
                                    'title' => Yii::t('app', 'Update'),                              
                        ]);
                    }
                },
                'delete' => function ($url, $model) {
                    if (Yii::$app->user->can('delete-offer')) 
                    {
                        return Html::a('<span class="glyphicon glyphicon-trash"></span>', $url, [
                                    'title' => Yii::t('app', 'Delete'),
                                    'data-confirm' …
Run Code Online (Sandbox Code Playgroud)

gridview action pjax yii2

2
推荐指数
1
解决办法
2384
查看次数

标签 统计

action ×1

gridview ×1

pjax ×1

yii2 ×1