Hide extra column # in gridview


(Samiloxphp) #1

I created a Gridview widget but I have extra column labeled by # mark and it’s same the primary key value . I don’t know how I can delete it . I don’t find any column

related to it in my code .

This is my gridview code




<?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',

        	],

        	// 'file_code',

        	// 'uploader',

        	// 'upload_date',

        	// 'privacy',

        	// 'password',

        	// 'file_title',

        	// 'file_description',

        	// 'deleted',

        	// 'delete_date',

        	[

            	'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')]);

                	},

            	],

        	],


        	/*

        	[

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

            	'template' => '{download} {view} {update} {delete}',

            	'buttons' => [

                	'download' => function ($url, $model) {

                    	return Html::a(

                        	'<span class="glyphicon glyphicon-cog"></span>',

                        	'#',

                        	[


                        	]

                    	);

                	},

            	],

        	],

        	*/







        	],

	]); ?>

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


(Samiloxphp) #2

I found solution here

https://stackoverflow.com/questions/46316022/yii2-hide-autogenerated-column-in-gridview/46316073#46316073