2017-09-20 13 views
0

Gridviewウィジェットを作成しましたが、#マーク付きの余分な列があり、それは主キーの値と同じです。私はそれをどのように削除できるのか分かりません。私は自分のコードでそれに関連する列を見つけられません。Yii2 Hide Gridviewの自動生成された列

GeriviewはGiiで生成され、PAjaxが使用されました。

enter image description here

これは私のGridViewのコード

<?php Pjax::begin(); ?> 
     <?= GridView::widget([ 
     'id'=>'files', 
     'dataProvider' => $dataProvider, 
     'filterModel' => $searchModel, 
     'columns' => [ 
       ['class' => 'yii\grid\SerialColumn'], 
       'f_id', 
       [ 
       'attribute' => 'type', 
       'value' => function($model){ 
         return \app\models\Files::getIconOfExtension($model->type); 
       }, 
       'format' => 'raw', 
       'filter'=>false, 
       ], 

       'original_name', 
       'file_title', 
       [ 
       'attribute'=>'upload_date', 
       'value'=>'upload_date', 
     //  'filter' =>\yii\jui\DatePicker::widget(['language' => \app\components\MyGlobalClass::getLanguage(), 'dateFormat' => 'dd-MM-yyyy']), 
       'format' => 'html', 
       ], 

       [ 
       'class' => 'yii\grid\ActionColumn', 
       'template' => '{download} {view} {update} {delete}', 
       'buttons' => [ 
         'update' => function ($url, $model) { 
         return Html::a('<span class="btn glyphicon glyphicon-edit"></span>', ['update', 'id'=>$model->file_code],['title'=>\Yii::t('app','Update')]); 
         }, 
         'view' => function ($url, $model) { 
         return Html::a('<span class="btn glyphicon glyphicon-zoom-in"></span>', ['view', 'id'=>$model->file_code],['title'=>\Yii::t('app','View')]); 
         }, 
         'delete' => function ($url, $model) { 
         return Html::a('<span class="btn glyphicon glyphicon-trash"></span>', ['delete', 'id'=>$model->file_code],['title'=>\Yii::t('app','Delete')]); 
         }, 
         'download' => function ($url, $model) { 
         return Html::a('<span class="btn glyphicon glyphicon-download-alt"></span>', ['download', 'id'=>$model->file_code],['title'=>\Yii::t('app','Download')]); 
         }, 
       ], 
       ], 





       ], 
     ]); ?> 
<?php Pjax::end(); ?> 

答えて

4

ある

['class' => 'yii\grid\SerialColumn'], 
1

要件ごとに、次を使用して削除します。

 Remove the code ['class' => 'yii\grid\SerialColumn'], 
関連する問題