Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Disable pagination in Yii2 gridview

Tags:

gridview

yii2

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

like image 394
Bibash Adhikari Avatar asked Mar 29 '17 05:03

Bibash Adhikari


2 Answers

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

$dataProvider = new ActiveDataProvider([
    'query'      => SomeModelClass::find(),
    'pagination' => false,
]);
like image 120
Red Bottle Avatar answered Nov 19 '22 21:11

Red Bottle


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.

like image 45
Ravenous Avatar answered Nov 19 '22 23:11

Ravenous