server side JSON not paging
server side JSON not paging

Here's the HTML page: https://www.freecell.net/f/c/dbscores1.html?flavor=day&game=8x4
Here's the JSON source under the covers: http://freecell.net/f/fcv.p?start=0&length=100&game=8x4
It shows the proper number of pages but selecting page 2 never re-draws. I see the AJAX call to my server side Perl thingy but the UI never updates.
Datatables debugger didn't show anything. Nothing in the console.
More tomorrow.
confundido
This discussion has been closed.
Answers
Hi @confundido ,
The problem is because
draw
isn't being incremented - it's always returning1
. If it's the same as the client has received before, it's ignored.Cheers,
Colin
Ah ha, that works. Went back and re-read the docs about draw. No hint (that I see) that it needed to be incremented. It sounded like a unique req Id that I'd just echo back. But yeah, I never saw it passed as anything but 1.
Docs currently:
...it is strongly recommended for security reasons that you cast this parameter to an integer, rather than simply _**echoing **_back to the client what it sent in the draw parameter...
"Echoing" threw me off. Might want to add to the docs that this field needs to be incremented and huge thanks for the help.
confundido
Hmmm... researching another issue found a posting recommending:
"Your server response needs the match the sequence number sent."
That's from here: https://datatables.net/forums/discussion/57628
The
draw
value in the response isn't intended to be incremented. It is intend to be the value of thedraw
from the request. It is used as a sequence number. This way if Datatables sends two requests, draw = 1 then draw = 2 and the response is draw = 1 then it knows the data is from a previous request and to not process it.HTH, to explain that parameter.
Kevin
That was my impression exactly from the docs but Colin above says to increment and that mysteriously makes things work.
confundido
He probably meant it in a more generic sense indicating that your
draw
response was always the same. Simply incrementing won't guarantee the sequence will always work. Take for example this set of steps:Kevin
Ignore me, I'm daft! Kevin's explanation is correct, it needs to match the request. In m mind, that's always incrementing, but that's just a partial answer (fully explained by Kevin's response).
Ah ha again. I think the issue was I wasn't properly fetching the draw param Now it's working without the increment thing.