2016-05-18 85 views
1

在视图中,添加buttons会创建错误页面。如何取出Update按钮?从GridView删除更新按钮?

enter image description here

这是我的观点:

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

     'user.username', 
     'title', 
     'img_title', 
     'note_type', 

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

     // I do not want the Update button. 
     // Adding this 'button' creates a error. 
     // 'buttons' => ['{view},{delete}'] 

    ], 
]); ?> 

添加 '按钮'

Unknown Property – yii\base\UnknownPropertyException 
Setting unknown property: yii\grid\DataColumn::0 

回答

3

对不起,谁具有相同问题的其他用户时使用错误:

的值:

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

改为:

[ 
    'class' => 'yii\grid\ActionColumn', 
    'template' => '{view} {delete}' 
], 

的伎俩。