javascriptjqueryasp.net-mvcpaginationjquery-jtable

jQuery jTable pagination is not working properly


I'm using jquery jTable in my web-based project. Its pagination work fine when the number of rows less than 10,000. But when the number of rows exceeded from 10000, it causes an unfamiliar issue in its pagination. The pagination start skipping odd page numbering. You can see it in picture below:enter image description here

My javaScript code for jTable is:

$("#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) {

            }
        });

while my html tag for jTable is:

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

I explored a lot\, but didn't find the solution related to it. I'm further unable to understand this miss behavior.


Solution

  • And at last, I got succeeded to solve this issue. I go through the jquery.jtable.js whole file and find something strange in one of its function. The function was;

    _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
    }
    

    All you need is just to comment this portion of the above given function, or modify it according to your own implementation logic.

    In my above mentioned case, my no_of_pages were increasing from 1000, that's why its taking 2-steps on changing page and so on.