Start a new topic
Answered

Lazy Loading OR Pagination Query

Hi All,


From Kinvey i'm having some 2000 records. i need to fetch all the records and need to show in a tableview for user. it is taking lot of time. is there any thing like Lazy loading or some pagination queries.Help me from this.Thanks in advance.


Best Answer

Harish, 


We have a guide that goes over how to do this on a query-level available here:  http://devcenter.kinvey.com/ios/guides/datastore#modifiers .   


The code to handle the front-end pagination on iOS, is less trivial, and beyond the scope of what we can reasonably help with. 


Please let me know if you have any additional questions.


Thanks,




Hi anyone reply to this

Hi Damien Bell,


Im writing pice of code like this by using limit modifiers, can u check it once whether is it correct or not.


KCSQuery *query = [KCSQuery queryOnField:@"ccu_id" withExactMatchForValue:@"c331dce3bced562b"];

 

 query.limitModifer = [[KCSQueryLimitModifier alloc] initWithLimit:20];

 

 query.skipModifier = [[KCSQuerySkipModifier alloc] initWithcount:20];

 

 KCSQuery *combinedQuery = [KCSQuery queryForJoiningOperator:kKCSAnd onQueries:query, nil];

 

 [_alertCollectionStore queryWithQuery:combinedQuery

 withCompletionBlock:^(NSArray *objectsOrNil, NSError *errorOrNil) {


}


I need pagination query in my iOS application.. i'm using tableview so when i scroll my tableview remaining data has to load like as lazy loading.. can u help me from this. Thanks in Advance..

Answer

Harish, 


We have a guide that goes over how to do this on a query-level available here:  http://devcenter.kinvey.com/ios/guides/datastore#modifiers .   


The code to handle the front-end pagination on iOS, is less trivial, and beyond the scope of what we can reasonably help with. 


Please let me know if you have any additional questions.


Thanks,



Thanks Damien Bell for replying to my question,


Can you give me some example like as query or some piece of code. and i need when i'm scrolling the tableview in iPhone again it has to be queried. like as lazy loading. Thanks in advance.


Harish:  


Yes we do support pagination:  ?query.....&limit=100&skip=100  where limit is the number per page and skip is what you increment when calling additional pages.


Thanks,