我创建了一个Gridview小部件,但我有额外的列标记为#mark,它与主键值相同。我不知道如何删除它。我的代码中没有找到任何与之相关的列。
Geriview由Gii生成,我在其中使用了PAjax。
这是我的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(); ?>
答案 0 :(得分:4)
删除
['class' => 'yii\grid\SerialColumn'],
答案 1 :(得分:1)
根据要求使用以下内容:
Remove the code ['class' => 'yii\grid\SerialColumn'],