2017-02-22 209 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步驟。