Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to set page size in GridView in yii2 [closed]

Tags:

gridview

yii2

I want to set item per page in GridView in view file in a Yii2 project. I know I can set it in DataProvider instance, but I want to set in each view file separately.

How can I do it?

like image 645
hd. Avatar asked Jun 01 '15 09:06

hd.


1 Answers

I hope this could help you

 public function actionIndex()
 {
    $searchModel = new ContribuenteSearch();
    $dataProvider = $searchModel->search(Yii::$app->request->queryParams);

    $dataProvider->pagination->pageSize=15;

    return $this->render('index', [
        'searchModel' => $searchModel,
        'dataProvider' => $dataProvider,
    ]);
 }
like image 74
ScaisEdge Avatar answered Oct 13 '22 20:10

ScaisEdge