I have a page where I render items from my database in reversed chronological order. Last added item is the first item on top of the page.
I use infinite scrolling, so everytime the user hits the bottom, I send pagenumber and resultcount to my server. There I use propel paginate to get the next page.
The problem is, when an user adds a new item on the page it will be added to my database and is the first item on page 1 in my results. So all other results are shifted by 1 position.
Is there a way to tell propel that it should start at offset+1 to ignore the new added element?
A little example:
I have 5 items per page. In this example every item has only a number, so on the page you can see 1,2,3,4,5. Now, a user adds the item 0. My database results w/o pagination is now:
0,1,2,3,4,5 because the new item is added. Now the user hits the bottom of the page and the pagination has the attributes page = 2, items per page = 5 and I will get 5,6,7,8,9. Now my page renders the 5 again. If I could say propel that the initial offset should start after the first item, the result would be ok.
Just an idea, haven’t tried the code myself, but you could add a timestamp to the search criteria and pass it in with the paging so that all search results are restricted to records created before the current search began: