Now I blend in pagination using Spring Boot, like so:
I have following data:
Exactly six TODO records with their title from do a to do f, with indexes from 1 to 6.
The UI in the browser once the page first time loads (attachment 1).
It looks like this:
Now, once the page first time loads, I set property of prototype called pageNumber, as I explaind above. The first time loading of a page will bring me two TODOs object, along with information whether it is the last page or not.
Each time I click Load more todos button, "static" pageNumber variable increases and I get following two entities. Increasing of variable looks like this:
Here is the problem:
Once I click second time, on my UI I have do a, do b, do c and do d. Next I delete do b and do c. I do remove the from UI and logically delete the from database, like so:
Now in UI, I have do a and do d. Here comes the problem. In my database I'm sure I have do e and do f not deleted, but once I click for the second time on Load more button, the pageNumber is equal to 2 (which is okey) and in my response I get that the page is last, but I get an EMPTY Json array! Drives me nuts!
Next, if I load page one more time, those last two elements do e and do f get fetched from db.
Here is how my Ajax GET request looks like:
These is the function which gets called on button click: