Pagination in gridview Yii2 without page reload

I am starting Yii2. I almost completed my entire setview, except for pagination. I tried using pjax but cannot find a solution.

+5
source share
3 answers

You must set a timeout for Pjax (default is 1000 ms). Sometimes this is not enough, and the plugin will completely reload the page.

<?php \yii\widgets\Pjax::begin(['timeout' => 10000, 'clientOptions' => ['container' => 'pjax-container']]); ?> <?= GridView::widget([ // ... configuration here ]);?> <?php \yii\widgets\Pjax::end(); ?> 

see here

+8
source

Put your code between Pjax :: begin and Pjax :: complete this job for every thing, not just gridview

 <?php \yii\widgets\Pjax::begin(); ?> <?= GridView::widget([ // ... configuration here ]);?> <?php \yii\widgets\Pjax::end(); ?> 
+2
source

This can help...:)

Just run and run Pjax, that's all ..

 <?php use yii\widgets\Pjax; <?php Pjax::begin(['id'=>'type_id']); //id is used for jquery opertaion ?> <?php echo GridView::widget([ 'dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'columns' => [ ['class' => 'yii\grid\SerialColumn'], //'id', //'user_id', 'type', ['class' => 'yii\grid\ActionColumn'], ], ]); ?> <?php Pjax::end(); ?> 
+1
source

Source: https://habr.com/ru/post/1207782/


All Articles