Pagination Issue when total rows not divisible exactly by lengthMenu property

Pagination Issue when total rows not divisible exactly by lengthMenu property

BethellJackBethellJack Posts: 3Questions: 1Answers: 0

Link to test case:
Debugger code (debug.datatables.net): Debugger not working, returns "DevTools failed to load source map: Could not load content for https://debug.datatables.net/dist/css/maps/debug.css.map: HTTP error: status code 404, net::ERR_HTTP_RESPONSE_CODE_FAILURE"
Error messages shown: None
Description of problem: I have a data table that returns 10 rows, and the lengthMenu is set to 7, I cant access the last 3 rows by using the pagination "next" or clicking on the "2" in the pagination of my data tables. I cant replicate the issue in a test case as it works expectedly everywhere except our development teams project.

The most curious part of it all is that if I change the lengthMenu to be 5 instead of 7 (or any number divisible by the amount of rows returned) then the pagination works perfectly. I've been told this is a reoccuring issue but we cant seem to find anything online to help out.

Any help/advice would be much appreciated.

Thankyou.
Jack

This question has an accepted answers - jump to answer

Answers

  • kthorngrenkthorngren Posts: 20,425Questions: 26Answers: 4,794

    Do you get errors in the browser's console when the problem happens?

    With 10 rows I would expect that you don't have server side processing enabled but do you have it enabled?

    Can you post a link to your page so we can help debug?

    Kevin

  • BethellJackBethellJack Posts: 3Questions: 1Answers: 0

    Hi Kevin,

    Thanks for your reply.

    No errors appear within the console when this happens. Server side processing is also not enabled. Unfortunately the page is hosted internally and therefore can't be shared.

    Understandably I can imagine its hard to help without this, which I can appreciate but we thought it's worth a shot anyway!

    Thankyou
    Jack

  • allanallan Posts: 61,972Questions: 1Answers: 10,160 Site admin
    Answer ✓

    Have you also set the pageLength option? It will need to be set to match your customised lengthMenu.

    Allan

  • BethellJackBethellJack Posts: 3Questions: 1Answers: 0

    Hi Allan,

    That seemed to have worked. Thankyou for the helpful advice and the prompt reply that is really appreciated.

    Kind Regards,
    Jack

Sign In or Register to comment.