Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Yii2 Listview pagination with ajax

I'm studying yii2 framework. I have a trouble when use listview wiget. When I click next page I want to update page but not reload. but I don't know how do it? this is url when click next page:

http://......&page=1&per-page=5

Please help me?

Thank you so much.

like image 529
Tam Vo Avatar asked May 06 '16 08:05

Tam Vo


1 Answers

Do like this:

use yii\widgets\Pjax;
Pjax::begin([
'enablePushState' => false, // to disable push state
'enableReplaceState' => false // to disable replace state
]);
echo ListView::widget([...]);
Pjax::end();

For more info refer this link: http://www.yiiframework.com/doc-2.0/yii-widgets-pjax.html

like image 64
merlano trevis Avatar answered Nov 09 '22 12:11

merlano trevis