I have following code, which crates a cell table and adds SimplePager to it.
public class CellTableTestClass {
private VerticalPanel applicationPanel = new VerticalPanel();
private CellTable<Contact> cellTable = new CellTable<Contact>();
public VerticalPanel createContent() {
List<Contact> list=Arrays.asList(new Contact("John","123 Fourth Road"), new Contact("Mary", "222 Lancer Lane"), new Contact("Zander", "94 Road Street"), new Contact("Harry","303 Shakti"));
cellTable.addColumn(new TextColumn<Contact>() {
@Override
public String getValue(Contact object) {
return object.name;
}
}, "Log Name");
cellTable.addColumn(new TextColumn<Contact>() {
@Override
public String getValue(Contact object) {
return object.address;
}
}, "Size");
// create a pager, giving it a handle to the CellTable
SimplePager.Resources pagerResources =
GWT.create(SimplePager.Resources.class);
SimplePager pager = new SimplePager(TextLocation.CENTER,
pagerResources, true, 0, true);
pager.setDisplay(cellTable);
pager.setPageSize(2);
cellTable.setRowData(0,list);
cellTable.setRowCount(list.size());
// add the Pager to the dialog
applicationPanel.add(pager);
applicationPanel.add(new HTML("<hr />"));
applicationPanel.add(cellTable);
return applicationPanel;
}
}
When I click the next button of the pager it shows loading screen only. Can anyone point out the possible errors in the code??
Here is a simple example of CellTable, SimplePager and ListDataProvider.
Hope this may help..