Cell Table, Remote Paging Issues

55 views
Skip to first unread message

BST

unread,
Jul 30, 2011, 3:29:29 AM7/30/11
to google-we...@googlegroups.com

I am trying out Remote Paging with a Cell Table & Implementation of Abstract Pager . For now I am limiting the CellTable to 30 rows for data. My Pager takes care of fetching the next batch of 30 rows from RemoteService, when the next or previous button is clicked.

I get 30 rows of data from the service, which I put into a list and set it to the ListDataProvider. The List can have only 30 rows of data at a time. I am doing all the calculations for calculating which page I am in, and when do I have to fetch the data.

Everything is working perfectly except for one scenario, I am on the last page which has only 20  rows, as the data is exhausted on the Server.

When I go previous, I set the table Visible range to(20,10), 10 being the pageSize, then I get the previous batch of data so that when the listDataProvider gets the new List the table shows the last page. But I find that it always goes to the first page which is visible range (0,10)..

The reason is that when I set the Visible Range to 20,10 since present table count is only 20, the visible range is not set properly..

If i set the Visible Range after I get the data from the server, the problem is pretty much the same, since the server call for data is asynchronous and data comes much after I set the visible range.

Only option is to use a timer but I don't think that would be wise. Any ideas is much appreciated? I guess it is just about a better logic to handle to handle the paging. Mine seems to be lacking..

Andrei

unread,
Jul 30, 2011, 6:56:16 AM7/30/11
to Google Web Toolkit
This is a well known issue with Abstract Pager/SimplePager. I don't
like this behavior (and the look of the default SimplePager), so I
ended up writing my own pager along the following lines:

http://www.mail-archive.com/google-we...@googlegroups.com/msg62763.html

Basically, I had to overwrite lastPage(), firstPage(), nextPage() and
previousPage() with the behavior that I wanted.

BST

unread,
Jul 31, 2011, 1:19:31 AM7/31/11
to google-we...@googlegroups.com

I didn't think of overriding last Page & first Page. Thanks for the pointer.. I shall look into the link.
Reply all
Reply to author
Forward
0 new messages