Jul 30, 2011, 3:29:29 AM7/30/11
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..