Wednesday, October 26, 2011

Re: CellTable - how to load just one page?



On Wednesday, October 26, 2011 7:20:20 AM UTC+2, Magnus wrote:
Hi,

I have a large list, which I do not want to load all at once. I would like to load and display just one page and let the user navigate to other pages.

The problem I see with CellTable is that it needs the whole list at once (setRowData). So I have to transfer all the data. Is it possible just to load the data for one page, and load the next portion if the page changes?

Are you kidding me? Just 2 days ago you asked how to display the whole data you loaded because CellTable uses paging by default!

Either you have the whole data set and you can call setRowData(List), which is just a shorthand for setRowCount(list.size());setRowData(0,list);
Or you have only a portion of the data (generally the size of a page, but not necessarily) and you'll call setRowCount (either you know exactly how many items the whole dataset contains, and you can call setRowCount(int), or you're not sure and you'll call setRowCount(int,boolean) passing 'false' as the second argument; if you really don't know, you can pass any big value as the first argument, and then adjust it later when you've reached the end of the dataset, ofr instance) and setRowData(int,List).

Other questions:
How can I add a simple navigation buttons (page next, last) to a CellTable?

SimplePager ?

Finally, assume that the CellTable resides within a panel with a given size. Is it possible to set the page size so that there are no scroll bars, i. e. fill the panel with cell rows without exceeding the available space?

Only if you know in advance the height of a rendered row. You could also, I guess, reduce the page-size once loaded if you detect that scrollbars are necessary, until they're no longer needed (i.e. load a bit too many and then only show what fits in the display area).

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To view this discussion on the web visit https://groups.google.com/d/msg/google-web-toolkit/-/C2kwMsLcbiwJ.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to google-web-toolkit+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.

No comments:

Post a Comment