Reputation: 7306
I have simple pagination scheme
gives users at page 1 after what i can ask next page like
and etc for next pages
But i have 2 problems:
[user1, user2, user3] but when i try fetch from database i can got [user2, user1, user3] for example.
I try use RestKit metadata property
@metadata.mapping.collectionIndex
But it's work each request independently. Happen next for
http://api/users?page=1 i got array
[user1, user2, user3] collectionIndex will be [1,2,3].
But then i ask next page and got array
[user4, user5, user6] collectionIndex also will be [1,2,3]
so in database
[user1, user4, user2, user5, user3, user6]
it's not correct.
So first question: is it possible use collectionIndex for pagination requests without resets collectionIndex?
I ask
http://api/users?page=1 and got 2 users
[user1, user2] in response
after i ask second page and got 2 users
[user3, user4] in response
so i ask again page=1 and now i got users [user01, user02]
and then go increment page index but, in page=2 i got [user1, user2] and in tableview in UI i see al records
[user01, user02, user1, user2, user3, user4]
and then page ask nothing changes, so user can't understand is paging work?
To fix it i use FetchRequestBlock and then page=1 i erase all users - it's bad solution.
How to correct paginate data from server?
Upvotes: 1
Views: 230
Reputation: 119031
Upvotes: 2