I am trying use cursor for pagination.
Forwarding pagination work fine, but I can not find solution for getting previouse page.
I found method Cursor.reverse(), but if I use this method I have this:
FORWARD CURSOR:
Get first page, result:
1,2,3,4,5,6,7,8,9,10(getCursor()).
Continue from getting cursor, result:
11,12,13,14,…
REVERSED CURSOR:
Get first page, result:
1,2,3,4,5,6,7,8,9,10(getCursor()).
Continue from getting cursor with reverse, result:
10,11,12,…
Also I am trying change ordering query but this not working too.
Maybe someone know solution for change direction for cursor.
As I recall, for using cursors with JDO, I store the cursor string for each “page” of data.
To traverse backwards, you will need to retrieve the correct cursor and use that.
Your logic will need to cater for knowing when the user’s current “page” of results is the first and thus has no previous “page”.
As for using cursors without JDO, I’ll leave that to others to answer.