Total entries differs from # of returned values and # of pages are a fraction of expected.

Total entries differs from # of returned values and # of pages are a fraction of expected.

cgdavecgdave Posts: 3Questions: 1Answers: 0

I am using server side processing and running into an issue displaying all the results. In the info section I have this message "Showing 31 to 31 of 31 entries (filtered from 647 total entries)". However, there are only two pages available in the pagination section. As a result I am only able to view 60 results rather then the full 647.

a portion of the response is shown below.

{"draw":1,"recordsFiltered":31,"recordsTotal":647....}

I'm not sure as to why this would be happening

Answers

  • kthorngrenkthorngren Posts: 21,171Questions: 26Answers: 4,922

    That means you have a search applied to the table. Sounds like you have Page Length of 30. With the search applied you have only 2 pages worth of data you can view.

    Kevin

  • cgdavecgdave Posts: 3Questions: 1Answers: 0
    edited April 2020

    Hmm strange. In the request, I am not passing anything into the search parameter. Search is disabled on my table. Could search still be the cause of this issue given the fact it's not enabled?

  • kthorngrenkthorngren Posts: 21,171Questions: 26Answers: 4,922

    Can you post all the parameters sent in the XHR request?

    Maybe there is a columns search? Do you have statesave enabled that is causing a search? Can you post a link to your page so we can take a look?

    What is the server script you have. If the parameters sent are correct is it parsing the parameters correctly?

    Kevin

  • cgdavecgdave Posts: 3Questions: 1Answers: 0
    var request = {
            draw: data.draw,
            start: data.start,
            stop: data.start === 0 ? 30: data.start + 30,
            sort: column,
            direction: dir,
            session: Date.now()
    };
    

    State save is enabled, however the search being applied to that obj is an empty string.

    {search: "", smart: true, regex: false, caseInsensitive: true} 
    

    I am unable to share a link of the page and the server script is parsing the parameters correctly.

  • kthorngrenkthorngren Posts: 21,171Questions: 26Answers: 4,922

    Not sure what you are doing with the request variable.

    State save is enabled, however the search being applied to that obj is an empty string.

    StateSave will override the config options. You can use stateSaveParams to modify what is saved. The docs have an example of resetting the search string.

    Does the Search input have a search term when reloading the page?

    If this doesn't help the please post the following:

    1. Datatables init code.
    2. Use the browser's Network Inspector to view the request. If using Chrome that would be the Headers. Copy the bottom section (Query String Parameters) into this thread.
    3. Copy the Response into the thread without the data object.

    Or you can use the debugger to collect information for the developers to look at.

    Kevin

This discussion has been closed.