Hi Dan,
Whenever a new ItemIterable object is created, it gets fresh data from
the server.
So, yes, calling itemIterable.skipTo(offset).getPage(100) gets you the
fresh data and there are no plans to change this behavior.
- Florian
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.