Tam Vo
Tam Vo

Reputation: 185

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.

Upvotes: 5

Views: 4533

Answers (1)

merlano trevis
merlano trevis

Reputation: 89

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

Upvotes: 8

Related Questions