You need to create a class that extends AsyncDataProvider . In this class, you can override the onRangeChanged method.
My class, for example, looks like this:
public class AsyncListProviderVisit extends AsyncDataProvider<MyObject> { @Override protected void onRangeChanged(HasData<MyObject> display) {
Then you need to create a DataGrid, AsyncProvider and Pager, for example:
// Create a CellList. DataGrid<LcVisits> grid = new DataGrid<LcVisits>(); // Create a data provider. AsyncListProviderVisit dataProvider = new AsyncListProviderVisit(); // Add the cellList to the dataProvider. dataProvider.addDataDisplay(grid); // Create paging controls. SimplePager pager = new SimplePager(); pager.setDisplay(grid); // and add them to your panel, container, whatever container.add(grid); container.add(pager);
change
as Andre pointed out in his comment, you also need to get the correct line counter for the query. I did this with a "fake object", which I add to my list and then delete it on the client side. You can then call updateRowCount(rowCount, isExact) , where isExcact is a boolean that indicates whether the row count you entered was accurate or just evaluated.
source share