9
I have tried pagination with Celltable and it goes fine.
In your activity, you should do something similar to this:
CellTable table;
@Override
public void start(AcceptsOneWidget panel, EventBus eventBus) {
// Get the table from the view
view.setPresenter(this);
panel.setWidget(view.asWidget());
table=view.getCellTable();
final SingleSelectionModel<Your_Class> selectionModel = new SingleSelectionModel<Your_Class>();
table.setSelectionModel(selectionModel);
selectionModel.addSelectionChangeHandler(
new SelectionChangeEvent.Handler() {
public void onSelectionChange(SelectionChangeEvent event) {
Your_Class selected = selectionModel.getSelectedObject();
if (selected != null) {
// Go to edit screen with selected.getId();
}
}
});
}
Then in your implementation view create the columns:
table = new CellTable<Your_Class>();
table.setSelectionModel( new SingleSelectionModel<Your_Class>());
And finally put the pagination:
SimplePager pager;
SimplePager.Resources pagerResources = GWT.create(SimplePager.Resources.class);
pager = new SimplePager(TextLocation.CENTER, pagerResources, true, 0,true);
pager.setDisplay(table);
dataProvider.setList(list_of_data);
pager.setPageSize(number_you_want);
yes.CellTable is really a good option for pagination.Once you get used to it.u will find it very user friendly.use simplePager for pagination.