skeeks/yii2-ajax-pager

jQuery contextMenu 插件及 polyfill for yii2

安装次数: 1,045

依赖者: 1

建议者: 0

安全性: 0

星标: 0

关注者: 2

分支: 0

开放问题: 0

语言:JavaScript

类型:yii2-extension

2.0.0.1 2019-08-12 10:46 UTC

This package is auto-updated.

Last update: 2024-09-12 21:45:48 UTC


README

Ajax页面加载 + js分页

Latest Stable Version Total Downloads

安装

安装此扩展的首选方式是通过composer

运行

php composer.phar require --prefer-dist skeeks/yii2-ajax-pager "*"

或者添加

"skeeks/skeeks/yii2-ajax-pager": "*"

示例

http://www.v3toys.ru/detskij-transport/ehlektromobili/

echo \yii\widgets\ListView::widget([
    //...
    'pager'        => [
        'id'                    => 'sx_v3toys_paginator',
        'class'                 => \skeeks\yii2\ajaxpager\AjaxLinkPager::class,
        'noneLeftText'          => '',
        'item'                  => '.catalog-list__item',
        'container'             => '.catalog-list',
        'paginationSelector'    => '.catalog-list .pagination',
        'triggerTemplate'       => '<div class="ias-trigger main-catalog__btn"><a class="btn btn-grey btn-lg">{text}</a></div>',
        'triggerText'           => 'Показать еще',
        'spClientOptions'       => [
            'listStyle' => 'paging-list',
            'prevText'  => '',
            'nextText'  => '',
            'edges'     => '1',
        ],
        'spClientMobileOptions' => [
            'listStyle'      => 'paging-list',
            'prevText'       => '',
            'nextText'       => '',
            'displayedPages' => '1',
        ],

        'eventOnPageChange' => new \yii\web\JsExpression(<<<JS
function(pageNum, scrollOffset, url) {
sx.App.jLastProduct = jQuery(".catalog-list__item:last");
var getCurrentPage = jQuery('#sx_v3toys_paginator').pagination('getCurrentPage');
var result = getCurrentPage + 1;
jQuery('#sx_v3toys_paginator').pagination('drawPage', result);
}
JS
        ),

        'eventOnRendered' => new \yii\web\JsExpression(<<<JS
function(pageNum, scrollOffset, url) {
sx.App.ImageLazyLoader.update();
sx.App.ImageProductSlider.update();



jQuery('.catalog-list__link-not-ready span').ellipsis({
lines: 2,             // force ellipsis after a certain number of lines. Default is 'auto'
ellipClass: 'ellip',  // class used for ellipsis wrapper and to namespace ellip line
responsive: true      // set to true if you want ellipsis to update on window resize. Default is false
});

jQuery(".catalog-list__link-not-ready").removeClass('catalog-list__link-not-ready');

var getPagesCount = jQuery('#sx_v3toys_paginator').pagination('getPagesCount');
var getCurrentPage = jQuery('#sx_v3toys_paginator').pagination('getCurrentPage');

sx.App.jLastProduct.after('<li class="main-catalog__sepatrator"><span>Страница ' + getCurrentPage + ' из ' + getPagesCount + '</span></li>');

}
JS
        ),
    ],
    //...
]); ?>

链接

skeeks!
SkeekS CMS (Yii2) — 快速、简单、有效!
skeeks.com | cms.skeeks.com