Yii2: How to remove the filter in GridView header

Created on 24 Feb 2015  路  4Comments  路  Source: yiisoft/yii2

Hello.

I want to remove the filter from the header in GridView. I am trying with: 'layout' => "{summary}\n{items}\n{pager}", but it doesn't work.

9666db3bbf1fb83f935b0f25c6968039

Most helpful comment

Just hide omit the filterModel config item from your gridview constructor

<?= GridView::widget([
            'dataProvider' => $dataProvider,
            // 'filterModel'  => $searchModel,
            'columns'      => [
                .....
            ]
        ]);
    ?>

All 4 comments

Just hide omit the filterModel config item from your gridview constructor

<?= GridView::widget([
            'dataProvider' => $dataProvider,
            // 'filterModel'  => $searchModel,
            'columns'      => [
                .....
            ]
        ]);
    ?>

You shoud hide the filter model than your filter will be remove.Please check the below code.

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

        'post_id',
        'post_title',
        'post_description:ntext',
        'user_id',

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

I was also searching for this. thanks I just removed it.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

deecode picture deecode  路  50Comments

gpoehl picture gpoehl  路  47Comments

vercotux picture vercotux  路  47Comments

rosancoderian picture rosancoderian  路  46Comments

sapsxxxil picture sapsxxxil  路  50Comments