M
M
My joy2018-05-24 20:36:58
Yii
My joy, 2018-05-24 20:36:58

Why does ajax scroller in gridview duplicate already displayed data?

Good evening fellow friends!
There is a PageScroller, it is connected to the GridView as standard:

'pager' => [
                            'class' => ScrollPager::className(),
                            'container' => '.grid-view tbody',
                            'item' => 'tr',
                            'paginationSelector' => '.footer',
                            'enabledExtensions' => [
                                ScrollPager::EXTENSION_SPINNER,
                                ScrollPager::EXTENSION_PAGING,
                            ],
                         ],

first of all, when the page loads, 5 records are displayed (everything is as it should, there are no more). after scrolling the page, this data starts loading again and is added to the existing ones. in total there are 15 entries (3 times 5 identical). what is this magic? why exactly 3 times? how to fix it?
ActiveDataProvider is responsible for data output:
$query = Orders::findBySql($q, $bind);
        $dataProvider = new ActiveDataProvider([
            'query' => $query,
            'sort' => [
                'attributes' => [
                    'orders_count',
                    'sum_avg',
                    'bid_avg',
                 ],
             ],
]);

maybe something needs to be added to the dataprovider so that it grabs the necessary pagination from get requests?

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