簡體   English   中英

jQuery bootgrid插件雙重分頁

[英]Jquery bootgrid plugin double pagination

我有個問題。 我需要更改jquery bootgrid插件,以便它可以進行多重創想。 IE如果用戶發送參數數組,例如['top-left','bottom-left'],則bootgrid必須在bootgrid表的頂部和底部都具有分頁功能。

我創建了在其中添加它們的方法,但是只能在同一行中添加2,它在頂部創建空分頁div,但在底部div中插入2個分頁

    Grid.prototype.setPaginationBar = function (params) {
            if (params[0] == "top-left") {
                $('.table-responsive').prepend(this.footer);
                var bar = $('.paginationBar');
                $(bar).insertBefore('.infoBar');
                $(bar).addClass('paginationBarLeft');
                $(bar).removeClass('paginationBar');
            }
            else if (params[0] == "top-right") {
                $('.table-responsive').prepend(this.footer);
            }
            else if (params[0] == "bottom-left") {
                var bar = $('.paginationBar');
                $(bar).insertBefore('.infoBar');
                $(bar).addClass('paginationBarLeft');
                $(bar).removeClass('paginationBar');
            }

            this.header = this.footer.clone();
            $('.table-responsive').prepend(this.header);
    };

我這樣叫方法

        var params = ['bottom-right', 'bottom-left'];
        $("#employee_grid").bootgrid("setPaginationBar", params);

這是bootgrid在我的方法之后調用的方法

    function renderPagination() {
        if (this.options.navigation !== 0) {
            var selector = getCssSelector(this.options.css.pagination),
                headerPagination = this.header.find(selector)._bgShowAria(this.rowCount !== -1),
                footerPagination = this.footer.find(selector)._bgShowAria(this.rowCount !== -1);
            if (this.rowCount !== -1 && (headerPagination.length + footerPagination.length) > 0) {
                var tpl = this.options.templates,
                    current = this.current,
                    totalPages = this.totalPages,
                    pagination = $(tpl.pagination.resolve(getParams.call(this))),
                    offsetRight = totalPages - current,
                    offsetLeft = (this.options.padding - current) * -1,
                    startWith = ((offsetRight >= this.options.padding) ?
                        Math.max(offsetLeft, 1) :
                        Math.max((offsetLeft - this.options.padding + offsetRight), 1)),
                    maxCount = this.options.padding * 2 + 1,
                    count = (totalPages >= maxCount) ? maxCount : totalPages;

                renderPaginationItem.call(this, pagination, "first", "«", "first")
                    ._bgEnableAria(current > 1);
                renderPaginationItem.call(this, pagination, "prevPage", "<", "prevPage")
                    ._bgEnableAria(current > 1);

                for (var i = 0; i < count; i++) {
                    var pos = i + startWith;
                    renderPaginationItem.call(this, pagination, pos, pos, "page-" + pos)
                        ._bgEnableAria()._bgSelectAria(pos === current);
                }

                if (count === 0) {
                    renderPaginationItem.call(this, pagination, 1, 1, "page-" + 1)
                        ._bgEnableAria(false)._bgSelectAria();
                }

                renderPaginationItem.call(this, pagination, "nextPage", "&gt;", "nextPage")
                    ._bgEnableAria(totalPages > current);
                renderPaginationItem.call(this, pagination, "last", "&raquo;", "last")
                    ._bgEnableAria(totalPages > current);

                replacePlaceHolder.call(this, headerPagination, pagination, 1);
                replacePlaceHolder.call(this, footerPagination, pagination, 2);
                //Pagination ADA fix
                paginationADA();
            }
        }
    }

如果有人能幫助我,我將非常感激,因為我不知道如何使bootgrid具有多個分頁,一個分頁,一個分頁

通過在網格初始化后調用方法來解決此問題。

    }).on("loaded.rs.jquery.bootgrid", function () {
        /* Executes after data is loaded and rendered */
        var params = ['top-right', 'bottom-right'];
        $("#employee_grid").bootgrid("setPaginationBar", params);
        Ladda.stopAll();
        //Delete

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM