I use the MGWT CellList which works perfect.
I have the following problem. How can I keep selected cells selected such that the remain selected after the user releases the cell?
Here is my implementation:
CellList<Item> myCellList = new CellList<Item>(new ItemCell());
My ItemCell class:
public class ItemCell implements Cell<Item> {
private static Template TEMPLATE = GWT.create(Template.class);
public interface Template extends SafeHtmlTemplates {
@SafeHtmlTemplates.Template("<div>{0}</div>")
SafeHtml content(String cellContents);
}
@Override
public void render(SafeHtmlBuilder safeHtmlBuilder, Item model) {
SafeHtml content = TEMPLATE.content(model.getName());
safeHtmlBuilder.append(content);
}
@Override
public boolean canBeSelected(Item model) {
return true;
}
}
My Item class:
public class Item {
private String name;
public Item() {
setName("");
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
}
What you want is selection handler. If you want single slection use SingleSelectionHandler, if you want multiple selections use MultiSelectionHandler, Sample code :
if you want to do anything on selection you can do it here