If one wants to paginate results from a data source that supports pagination we have to go to a process of:
- defining the page size - that is the number of results to show per page;
- fetch each page requested by the user using an offset = page number (0 based) * page size
- show the results of the fetched page.
All this is works just fine not considering the fact that an operation may affect the backend system that screws up the pagination taking place. I am talking about someone inserting data between page fetches or deleting data.
page_size = 10;
get page 0 -> results from 0 to 9;
user inserts a record that due to the query being executed goes to page 0 - the one just shown;
get page 1 -> results from 10 to 19 - the first results on the page is the result on the old page 0.
The described behavior can cause confusion to the viewer. Do you know any practical solution to workaround this problem.