Bibash Adhikari
Bibash Adhikari

Reputation: 173

Disable pagination in Yii2 gridview

How to disable pagination in Yii2 GridView? I am not using any kartik gridview. I am using the default Yii2 Gridview.

Upvotes: 8

Views: 20259

Answers (2)

Red Bottle
Red Bottle

Reputation: 3080

Try setting pagination (in your controller) to false, like this:

$dataProvider = new ActiveDataProvider([
    'query'      => SomeModelClass::find(),
    'pagination' => false,
]);

Upvotes: 22

Ravenous
Ravenous

Reputation: 1160

1) If you have a limited number of models, use ArrayDataProvider and get all models, instead of ActiveDataProvider.

2) You can specify it in the view, the layout property of the GridView can be set to {summary}{items}. The default one includes {pager} too.

Upvotes: 2

Related Questions