tags:

views:

173

answers:

2

I'm wondering if there are any standard methods of keeping the correct pagination of real-time lists. For instance, on Stack Overflow if I go to page 2, and in the period of looking at page 1 a new question was submitted, how can I keep page 2 the same as it was when I started looking at page 1?

A lot of the time people will just do an SQL query using a LIMIT but this won't allow you to keep track of where page 1 ended and page 2 begins.

I imagine it can be done by keeping track of the ID of the last seen record or something.

+3  A: 

I think most users are used to this behaviour and expect it to happen. When they go to the next page and they see the item that was at the end of the page they were just on is the first item of the current page, they will probably realize that it's because a new item was added. I know that I have depended on this behaviour as a user before to know when new content was added while browsing through the pages.

So my opinion is that you shouldn't have to do this.

yjerem
Agreed. All dynamic websites do it this way. It's silly not to!
sirlancelot
I completely disagree - this behavior is unintuitive and disconcerting. Esp. for e.g. SO when paging *forward* when the next page doesn't start immed. after the last item on the page you are leaving.
Software Monkey
Just today I was reading the comments on a news article and when I went to page 2 I saw two comments that I had already read so I went back and found two new comments on the first page. Without this behaviour I would have missed those comments... that's why I find this behaviour quite useful.
yjerem
+1  A: 

We do this (your requested) behavior for all our paginated web UI's. (I have actually asked for that in SO, and had it declined - but I find the current repagination annoying and unexpected - I hate hitting "next" and having the first n items be the last ones from the previous page).

The trick is to retain (usually in hidden variables) sufficient key information to position the list immediately before item 1 and immediately after the last item for the page you are looking at. Then your previous and next page links supply that information to on submit. Effectively you retain a "previous page" and "next page" key. This works intuitively for insertions and deletions.

One thing to bear in mind is that a refresh on page 1 (assuming like SO a newest items first list) should either (a) activate the "previous" link, if it was hidden, or (b) refresh the list from the top, including the added items. In other words "refresh" always redisplays the page from the first item inclusively, but if the first item on the page was also the first item in the list and now there are new items, it redisplays from the beginning of the list. With our lists we usually have, standard, links for "first page", "previous page", "refresh", "next page" and "last page".

The alternative for seeing new items is to always have a previous link and it backs up the smaller of a full page or the top of the list - and that's how a user sees new items (but I prefer to hide/disable the previous/next when there's no items previous and/or next).

Software Monkey