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?
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,
]);
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With