Pagination in gridview Yii2 without page reload

Sohel Tambadiya picture Sohel Tambadiya · Nov 27, 2014 · Viewed 11.8k times · Source

I am a Yii2 beginner. I have almost completed all of my grid-view except for pagination. I tried to use pjax but can't find a solution.

Answer

Rostyslav Pylypenko picture Rostyslav Pylypenko · Feb 2, 2015

You have to set timeout for Pjax (default is 1000 ms). Sometimes it is not enough and plugin will reload the page completely.

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

see here