CellTable with SimplePager displaying GAE datastore data in async

77 views
Skip to first unread message

George Agiasoglou

unread,
Jul 7, 2011, 12:47:48 PM7/7/11
to google-we...@googlegroups.com
Hi there, 

I have a celltable which displays data from GAE datastore using an AsyncDataProvider.

Everything works fine up to the last page. So if pageSize is 10 and the results are 35, doing 1-10, 11-20, 21-30 and back works fine. In order to do this I store cursors so that I can continue from where I left off or go back.

If however, I go to the last page and the range changes to display 25-35 and then back like so, 35-25, 25-15, 15-5 etc the cursors are rendered useless. 

Have you comes across this problem? What are your experiences? 

Maybe I am not using SimplePager properly? I am not complaining how the SimplePager is implemented, and I do understand the fact it manages to always maintain the same number of records in View and keep the hight constant.

Will the only solution be to write my own custom pager?

Thanks,
George

Ioan Agopian

unread,
Jul 8, 2011, 2:55:24 AM7/8/11
to Google Web Toolkit
What framework are you using to connect to the datastore?

I've not used JDO or JPA, but in Objectify you can set an offset and a
limit on a query. In onRangeChanged you can get them like this:
Range range = display.getVisibleRange();
Integer offset = range.getStart();
Integer limit = range.getLength();

So there's no need to work with cursors. If this functionality is not
exposed through your datastore layer you could always use the low
level api.

On Jul 7, 7:47 pm, George Agiasoglou <George.Agiasog...@newsint.co.uk>
wrote:

George Agiasoglou

unread,
Jul 8, 2011, 5:13:25 AM7/8/11
to google-we...@googlegroups.com
Hi Ioan, thank you for your reply.

Indeed I use objectify and to be honest I have not used the offset ever, however, when I was looking what's the best feature to use I stamped upon this thread https://groups.google.com/d/topic/objectify-appengine/tkC103e2ILQ/discussion 
and so I have only used cursors so far.

I may have to rethink my strategy, since I do not expect to have more than 8000-10000 records and offset sounds appealing. I will let you know if it works out!


Thanks,
George

George Agiasoglou

unread,
Jul 8, 2011, 8:25:43 AM7/8/11
to google-we...@googlegroups.com
Ioan it works fine, thank you!

-George
Reply all
Reply to author
Forward
0 new messages