我创建了一个自定义单元格,用于确定是否显示 aSelectionCell
或TextCell
. 在SelectionCell
渲染的情况下,我无法setFieldUpdater
触发该方法。
下面的代码...
private class CustomTypeCell extends AbstractCell<String>
{
SelectionCell selectCell = new SelectionCell(cardMnemonics);
TextCell textCell = new TextCell();
@Override
public void render(
Context context,
String value, SafeHtmlBuilder sb)
{
if (value != null)
{
textCell.render(context, value, sb);
}
else
{
selectCell.render(context, "", sb);
}
}
}
private class CustomTypeColumn extends Column<Object, String>
{
public CustomTypeColumn(CustomTypeCell cell)
{
super(cell);
}
@Override
public String getValue(Object object)
{
return object.getStringValue();
}
}
使用...实现
CustomTypeCell cell = new CustomTypeCell();
CustomTypeColumn customCol = new CustomTypeColumn(cell);
customCol.setFieldUpdater(new FieldUpdater<Object, String>()
{
public void update(int index, Object object, String value)
{
object.setStringValue(value);
// perform action }
});
cellTable.addColumn(customCol, "Custom Column");
如果我使用带有SelectionCell
.