我使用完美的MGWT CellList。
我有以下问题。如何保持选定的单元格处于选中状态,以便在用户释放单元格后保持选中状态?
这是我的实现:
CellList<Item> myCellList = new CellList<Item>(new ItemCell());
我的 ItemCell 类:
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;
}
}
我的物品类别:
public class Item {
private String name;
public Item() {
setName("");
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
}