Odd pagination behaviour in Chrome (Next button broken)

Odd pagination behaviour in Chrome (Next button broken)

IsaacTNIsaacTN Posts: 5Questions: 0Answers: 0

I'm experiencing odd behaviour with the pagination functionality. The first time I hit the Next button, it will go from page 1 to page 2, then, subsequent clicks on the Next button just reload page 2's data again and the active pagination button remains on 2. I checked the data sent to the server in the ajax request, and it is asking for the same starting row every time. Clicking on any of the numbered page buttons advances normally.

Data from headers:

Initial load (1st page):
start: 0
length: 10

First click on Next (which works fine):
start: 010
length: 10

Any subsequent clicks on Next (which just reload the same page data over and over):
start: 010
length: 10

Manual click on page 3:
start: 20
length: 10

And it hangs the same way with subsequent clicks on Next from page 3:
start: 20
length: 10

draw count is incrementing with each pagination click as it should and the response from the ajax call matches the draw number

Datatables 1.10.18
Chrome Version 73.0.3683.103 (Official Build) (64-bit)
Linux

Tested in Firefox and it doesn't appear to be affected.

I'm stumped. Any help would be greatly appreciated, even if it's just to point out that I've done something stupid. LOL It's entirely possible, I'm far from fluent in javascript, most of my development experience is in C++ and php.

Example: https://db.openkj.org/newreleases Click on the Week or 30 days buttons to populate the table with enough data for it to paginate.

Replies

  • tangerinetangerine Posts: 3,350Questions: 37Answers: 394

    Your pagination is working correctly for me with Chrome.

  • IsaacTNIsaacTN Posts: 5Questions: 0Answers: 0

    Okay, this is super odd. It works okay for me in an incognito tab but not in a normal one. I wonder if my browser just has something bad cached.

  • IsaacTNIsaacTN Posts: 5Questions: 0Answers: 0

    Well, that's embarrassing. That was it. You'd think a professional Linux sysadmin and developer would think to clear his bloody browser cache. hangs head in shame

  • tangerinetangerine Posts: 3,350Questions: 37Answers: 394

    Ah, the joy of browser caching. I haven't made that mistake myself for at least a week....

  • IsaacTNIsaacTN Posts: 5Questions: 0Answers: 0

    Actually, I found the real problem, had to do with integer/string casting. I hate weakly typed languages. heh

    I was able to duplicate the issue by setting the page length with the dropdown, which I catch the event from and save the desired page length in a cookie. After reloading the page with that value set in the cookie, it gets read into a variable and put in for pageLength when the datatable instance gets setup. Apparently feeding datatables a "25" instead of a 25 for pageLength makes the pagination choke on Chrome. Doesn't seem like the sort of thing that would cause that particular behavior, but I cleared the cookie value and did it several times and was able to duplicate the problem every time.

    Using parseInt to force it back to an integer fixed the problem.

This discussion has been closed.