Add numeric pager to jqGrid

后端 未结 3 1750
一整个雨季
一整个雨季 2020-12-09 12:33

Does anyone know of a way to set up jqGrid to use a numeric pager?

Instead of Page 1 of 20, I want to have the paging be like 1,2,3,4 > >> and when I click on 4 it w

3条回答
  •  离开以前
    2020-12-09 13:38

    And here's one more possible solution.

    It replaces the paging textbox with a list of links.

    loadComplete: function() {
        var grid = this;
        var container = jQuery("#prev_jqGridTablePager").next().next();
        jQuery(container).html('');
    
        var totalPages = grid.p.lastpage;
        for (var i = 1; i <= totalPages; i++) {
            if (i == grid.p.page) {
                jQuery(container).append("" + i + "");
            } else {
                jQuery(container).append("");
            }
        }
    
        jQuery(container).find("a.pagination").click(function(e) {
            e.preventDefault();
    
            var newPage = jQuery(this).text();
            jQuery(grid).trigger("reloadGrid", [{ page: newPage }]);
        });
    }
    

提交回复
热议问题