2017-02-22 208 views
1

我在我的基于Web的项目中使用jquery jTable。当行数小于10,000时,其分页工作正常。但是,当行数超过10000时,会导致其分页中出现不熟悉的问题。分页开始跳过奇数页编号。你可以看到它在下面的图片:enter image description herejQuery jTable分页无法正常工作

javaScriptjTable代码:

$("#AllProductTable").jtable({ 
      paging: true, 
      pageSize: 10, 
      columnSelectable: false, 
      actions: { 
       listAction: '/ProductDefinition/Select' 
      }, 
      fields: { 
       ProductId: { visibility: 'hidden', listClass: 'right-align' }, 
       ProductCode: { title: 'Product Code' }, 
       // more fields... 
      }, 
      recordsLoaded: function (event, data) { 

      } 
     }); 

,而我html标签为jTable是:

<div id="AllProductTable" style="width:400%;"></div> 

我探索了很多\,但没找不到与之相关的解决方案。我进一步无法理解这个错过的行为。

回答

0

最后,我成功解决了这个问题。我通过jquery.jtable.js整个文件,并找到其中一个function奇怪的东西。功能是;

_refreshGotoPageInput: function() { 
    // different logic statements 
    //... 

    //Skip some pages is there are too many pages 
    var pageStep = 1; 
    if (currentPageCount > 10000) {  // if you having more than 10,000 pages 
     pageStep = 100; 
    } else if (currentPageCount > 5000) { // if you having more than 5000 pages 
     pageStep = 10; 
    } else if (currentPageCount > 2000) { // if you having more than 2000 pages 
     pageStep = 5; 
    } else if (currentPageCount > 1000) { // if you having more than 1000 pages 
     pageStep = 2; 
    } 

    //.... 
    // Differnet logic statements 
} 

所有你需要的只是comment根据自己的实现逻辑给出了上述的这部分function,或修改。

在我上面提到的情况下,我no_of_pages从1000增加,这就是为什么它承担改变页2步骤。