Is it then safe to assume that every time I call itemIterable.skipTo(offset).getPage(100) I'll get fresh data from the server? will this stay the same in the future?
On 1/8/2014 3:06 PM, Florian Müller wrote: > Hi Dan, > > skipTo() and getPage() always create new ItemIterable objects and > leave the original ItemIterable untouched. > You can derive as many new ItemIterable objects with skipTo() and > getPage() as you need. > > > - Florian > > >> Hello, >> we use ItemIterable for paging through a query result. The data is >> displayed in a grid, page by page and the user can navigate back and >> forth. >> For the rendering phase we use a code similar to: >> >> Iterable it = itemITerable.skipTo(offset).getPage(50); >> foreach(Object obj: it) { >> ...... >> } >> >> Now I have to implement a refresh button that would have to refresh the >> currently displayed page (fetch the data again from the server). I know >> that the clean solution is to run the query again and get a new instance >> of ItemIterable and start from the same offset etc. but due to some >> awkward design decisions I am forced to work with the same ItemIterable >> instance and find a workaround. >> >> I have investigated the implementations of AbstractIterable and >> AbstractIterator (mainly CollectionPageIterable and >> CollectionPageIterator) and found out that a call to getPage() always >> returns a newly created instance of CollectionPageIterable which in turn >> will create a CollectionPageIterator which when requested to iterate >> will fetch the items from the server. >> >> Is my understanding of the implementation correct? >> Can I assume that the behaviour will stay the same (is part of the >> public API) ? >> >> Best regards, >> Dan. > > -- Corneanu Dan Sava Technologies SRL Sf. Nicolae Nr. 5 Ap. 2 300015 Timisoara Romania Phone: +40 256 201 269 Email: c...@savatech.ro Web: http://www.savatech.ro