I
I
Ildar7sins2017-10-13 13:22:01
Yii
Ildar7sins, 2017-10-13 13:22:01

How to fix loading in infinituyScroll and Pjax in Yii2?

Good afternoon, the essence of the problem: I use Pjax on the portfolio page, in order not to load all the work at once, I use nirvana / InfinityScroll, when entering the page everything works fine, but when I go through the categories, Pjax works and I get the following. On the main content page there are several pages of pagination, and in the categories for one / two, and if I did not display all the loaded pages on the main page, then they are displayed on others additionally. I thought about how to restart the ListView, but I didn’t find an option how ... Most likely this is due to the fact that when updating via Pjax JS does not work on a new one ...

Pjax::begin( );
//code
echo ListView::widget([
                    'dataProvider' => $dataProvider,
                    'itemView' => 'portfolio-list',
                    'id' => 'my-listview-id',
                    'layout' => "\n<div class=\"items\">{items}</div>\n{pager}",
                    'pager' => [
                        'class' => InfiniteScrollPager::className(),
                        'widgetId' => 'my-listview-id',
                        'itemsCssClass' => 'items',
                        'pluginOptions' => [
                                'loading' => [
                                'msgText' => " ",
                                'finishedMsg' => "<em>Поздравляем, вы добрались до конца Интернета...</em>",
                                ],
                            ]
                        ],
                    ]);
//code
Pjax::end();

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question