Reputation: 307
Im trying to create a scrollPanel that holds a list of checkbox item. My main problem is constructing a CellList with CheckboxCell. Here is a snippet of whats causing the compile time error.
CheckboxCell testCheckBox = new CheckboxCell();
CellList<String> cellList = new CellList<String>(testCheckBox);
Error Message: The constructor CellList(CheckboxCell) is undefined.
If this is the wrong constructor, what is the correct way?
Upvotes: 0
Views: 2177
Reputation: 209
You can try something like that. You are going to need some extra native code to handle the "check" event.
public class StyleCell extends AbstractCell<Style> {
@Override
public void render(Context context, Style row, SafeHtmlBuilder sb) {
if (row == null) {
return;
}
sb.appendHtmlConstant("<INPUT TYPE=CHECKBOX NAME='property'>" + row.getProperty() + "</INPUT>");
}
}
StyleCell styleCell = new StyleCell();
CellList<Style> styleList = new CellList<Style>(styleCell);
Upvotes: 1
Reputation: 18861
Try changing the type of CellList to Boolean.
CheckboxCell testCheckBox = new CheckboxCell();
CellList<Boolean> cellList = new CellList<Boolean>(testCheckBox);
update:
More examples on various cells (this is combined checkbox + picture, but you might want to replace picture with text):
http://gwt.google.com/samples/Showcase/Showcase.html#!CwCellTree
It's little trickier, but this showcase contains also sources so might want to dive into them.
PS: Lazier solution is not to use Cell Widgets and make own (extends Composite) combo/label and place it in say FlexTable :)
Upvotes: 2