News for hackers. Stuff that matters.
Re:Pagination 101 by JoshTriplett on Tuesday February 02, 2016 @01:21AM (#11017897)
One other key: don't identify current position by index, because then you'll miss or duplicate items when the list changes. If you show 1-10, then a change in the background adds 5.5 between 5 and 6, the next page will show 10-19. Worse, if a change in the background deletes 5, the next page will show 12-21, missing 11.

So instead, when showing items 1-10, the link for the next page of results should query for the next page full of items start after item 10.

That still lets the user miss added items (mostly unavoidable unless the list is sorted by "things the user hasn't seen yet"), but doesn't miss items when deleting seen items.

Re:Pagination 101 by calpaterson on Tuesday February 02, 2016 @03:07AM (#11018169)
Doing it this way is known as the seek method/"keyset pagination" and it's also quicker when you're quite deep in the list:

http://use-the-index-luke.com/sql/partial-results/fetch-next...