Monday, March 12, 2012

GWT SimplePager on CellTable is not Updating

The code below works on initialization, however if you add new data, it does not display the updated row.

Previous Code :
CellTable table = new CellTable();
SimplePager.Resources pagerResources = GWT.create(SimplePager.Resources.class);
pager = new SimplePager(TextLocation.CENTER, pagerResources, false, 0, true);
pager.setDisplay(table);
pager.setPageSize(10);
table.setPageSize(10);
ListDataProvider dataProvider = new ListDataProvider();
dataProvider.addDataDisplay(table);
List list = dataProvider.getList();
for (Carrier contact : data) {
list.add(contact);
}


Fix :
pager.startLoading();

Current Code :
CellTable table = new CellTable();
SimplePager.Resources pagerResources = GWT.create(SimplePager.Resources.class);
pager = new SimplePager(TextLocation.CENTER, pagerResources, false, 0, true);
pager.setDisplay(table);
pager.setPageSize(10);
table.setPageSize(10);
pager.startLoading();
ListDataProvider dataProvider = new ListDataProvider();
dataProvider.addDataDisplay(table);
List list = dataProvider.getList();
for (Carrier contact : data) {
list.add(contact);
}

No comments:

Email

java.padawan@androidph.com