It is good approach to fetch same data from server instead of maintain data block at client side.
-- If you write such a logic like
1)Maintain index in contact object or create one custom bean which has three variable like start, end and List<Contact>.
2)Create one List<Contact> or custom bean in DBHelper class
3) Before rpc call check in list if exist then don't make rpc call
4) If not exist data in list from start to end range
But according to better practice, make rpc call is not big cost.
Thanks,
Bhumika
On Tuesday, 8 October 2013 14:06:39 UTC+5:30, Nir Avital wrote:
On Tuesday, 8 October 2013 14:06:39 UTC+5:30, Nir Avital wrote:
Hi,
We are trying to create a cell table with tons of entries.
We use pagination. (AsyncDataProviderand Pager) and would like to fetch on demand entries.
Currently it does work as intended,
only problem is, when we show some entries on the cell table (let's say entries #1-#25)
and then change page to fetch the entries (#1000 - #1025)
when changing back again to entries #1-#25 gwt still makes a server call !
we would like to create a simple cache in the client and by this skip the unnecessary call like the example above.
any ideas?
Thanks.
P.S here is a piece of code of the onRangeChanged:
AsyncDataProvider<Contact> provider = new AsyncDataProvider<Contact>() { @Override protected void onRangeChanged(HasData<Contact> display) { int start = display.getVisibleRange(). getStart(); int end = start + display.getVisibleRange(). getLength(); end = end >= DBHelper.size() ? DBHelper.size() : end; List<Contact> sub = DBHelper.get(start, end); updateRowData(start, sub); } };
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscribe@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at http://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/groups/opt_out.
No comments:
Post a Comment