Let say I got 100 users online and Id like to show them all on the page with the limit of 20 per page.
Now the query would be ordering those users by the timestamp asc.
The problem Im facing is what if by the time I get to page 5 last users have become first ones case their timestamp is the most recent one. That would mean i would not get show them at all.
How does pagination work with the dynamic data.
By pagination I mean Jquery show more ajax data output.
If you want the data to be “live”, then going to page 5 and not seeing the people who have moved to page 1 is correct behavior.
If you want a snapshot of the data at the moment the person loads the page, pull all the data at once (don’t limit your query) and use Javascript to hold the data in memory and display it page-wise.
select all data.
store data as an array variable.
When you change page, instead of sending another ajax request, slice the array and hand the correct slice to your control code.
up to you, though I wouldnt recommend it if the logic’s going to be the same for every record. If your client never clicks on page 5, then the time you waste formatting the rows for page 5 could have been better off not used, right?