Re: Scrolling CellList sample?
I FOUND AN EASIER SOLUTION WITH THE SimplePager
I take my data from a database
public void init() {
htmlPanel.clear();
ProvidesKey<GwtUser> keyProvider = new ProvidesKey<GwtUser>() {
public Object getKey(GwtUser item) {
return (item == null) ? null : item.getUserId();
}
};
CellList<GwtUser> cellList = new CellList<GwtUser>(new GwtUserCell(),
keyProvider);
cellList.setRowCount(liste.size(), true);
cellList.setRowData(0, liste);
final SelectionModel<GwtUser> selectionModel
= new SingleSelectionModel<GwtUser>(
keyProvider);
selectionModel.addSelectionChangeHandler(new SelectionChangeEvent.Handler() {
public void onSelectionChange(SelectionChangeEvent event) {
user = ((SingleSelectionModel<GwtUser>) selectionModel).getSelectedObject();
fireEvent(new ValidEvent("change"));
}
});
final ListDataProvider<GwtUser> dataProvider =
new ListDataProvider<GwtUser>(liste);
SimplePager pager;
SimplePager.Resources pagerResources = GWT.create(SimplePager.Resources.class);
pager = new SimplePager(TextLocation.CENTER, pagerResources, true, 0,true);
pager.setDisplay(cellList);
dataProvider.addDataDisplay(cellList);
dataProvider.setList(liste);
pager.setPageSize(10);
cellList.setSelectionModel(selectionModel);
htmlPanel.add(cellList);
htmlPanel.add(pager);
}
AND THAT WORK!!!!!!!!!!!!!!!!!!!!!!!
--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscribe@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at http://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/groups/opt_out.
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home