Pagination is a normal and popular method of splitting data across pages. However, a new method has emerged (I forgot where I read about it first). Instead of distributing data across several pages (which is pretty non-Ajax), you place a scrollpanel around the data and load data when the scrollbar reaches the bottom.
See an example here.
Implementing this is actually pretty easy, especially with Google Web Toolkit. I've created a custom widget called ScrollAutoLoader, which handles scroll events. When used, you can implement scroll loading like this:
-
public class Module implements EntryPoint {
-
private int count;
-
private ScrollAutoLoader loader;
-
public void onModuleLoad() {
-
final VerticalPanel panel = new VerticalPanel();
-
-
loader = new ScrollAutoLoader(panel, new Loader() {
-
public void load(int offset, int limit) {
-
panel.add(new Label("Line " + ++count));
-
-
loader.fill();
-
}
-
}, 5);
-
-
loader.setHeight("300px");
-
-
RootPanel.get().add(loader);
-
loader.fill();
-
}
-
}
I've used the widget a couple of places, and it works pretty good. It might, however, be too slow if there are a lot of pages, as the browser tends to slow down when the inner panel becomes too large.



