kop / yii2-scroll-pager

Infinite AJAX scrolling for Yii2 ListView widget
https://kop.github.io/yii2-scroll-pager/
MIT License
180 stars 63 forks source link

Load previous items not working #110

Open vifus opened 3 years ago

vifus commented 3 years ago

When I scroll down list of products (on mobile) for example to second page and I enter to product from second page next I back to products list (URL: products?page=3&per-page=12) and i have products only from second page. I need show button "Load previous items". What Im doing wrong?

my code

    $this->widget['data']['dataProvider'] = [
        'dataProvider' => $dataProvider,
        'itemView' => $this->widget['itemView'] ?: $itemView,
        'summary' => '',
        'layout' => isset($this->widget['layout']) ? $this->widget['layout'] : "{summary}\n{items}\n{pager}" ,
        'itemOptions' => ['class' => $this->widget['itemClass']],
        'options' => ['class' => 'productsList'],
        'emptyText' => $this->widget['data']['emptyText'],
        'emptyTextOptions' => ['class' => 'col-xs-12 margin-bottom text-center emptySearch'],
        'pager' => !isset($this->widget['pager']) ? [
            'class' => \kop\y2sp\ScrollPager::className(),
            'container' => isset($this->widget['pagerconf']['container']) ? $this->widget['pagerconf']['container'] : '.productsList',
            'item' => isset($this->widget['pagerconf']['item']) ? $this->widget['pagerconf']['item'] : '.gridItem',
            'pagination' => isset($this->widget['pagerconf']['pagination']) ? $this->widget['pagerconf']['pagination'] : '',
            'spinnerTemplate' => '<div class="ias-spinner"></div>',
            'enabledExtensions' => isset($this->widget['pagerconf']['enabledExtensions']) ? $this->widget['pagerconf']['enabledExtensions'] :  [
                //IASTriggerExtension,
                //IASSpinnerExtension,
                \kop\y2sp\ScrollPager::EXTENSION_TRIGGER,
                \kop\y2sp\ScrollPager::EXTENSION_SPINNER,
                \kop\y2sp\ScrollPager::EXTENSION_NONE_LEFT,
                \kop\y2sp\ScrollPager::EXTENSION_PAGING,
                \kop\y2sp\ScrollPager::EXTENSION_HISTORY,
            ],
        ] : false,
    ];`

`

Daizygod commented 2 years ago

same problem, in README texted for attribute "historyPrev" - "Make sure there is only one element that matches the selector.", but it not help