Yar*_*nST 7 gwt selectionmodel celltable gwt-2.5
当使用TableBuilder创建行和亚行,如预期选择模型不能正常工作.单击子视图的复选框时,未选择该行,但是,将选择父行.
我尝试过载onBrowserEvent的CheckboxCell,以人工处理的选择,但似乎在DataGrid本身按checkboxcell时触发选择事件.
如果行和子行来自相同类型,如何添加支持行和子行的选择模型?
@Override
public void onBrowserEvent(Context context, Element elem, final T object,
NativeEvent event) {
// The provided row is always the root row, so we need to find the
// correct one when a sub row was edited
actualIndex = context.getSubIndex();
actualObject = object;
if (0 != context.getSubIndex() && object instanceof RowDTO) {
actualIndex = context.getSubIndex();
actualObject = (T) ((RowDTO) object).getChild(actualIndex - 1);
context = new Context(context.getIndex(), context.getColumn(),
actualObject, actualIndex);
}
ValueUpdater<C> valueUpdater = (getFieldUpdater() == null) ? null
: new ValueUpdater<C>() {
@Override
public void update(C value) {
getFieldUpdater().update(actualIndex, object, value);
}
};
getCell().onBrowserEvent(context, elem, getValue(actualObject), event,
valueUpdater);
}
Run Code Online (Sandbox Code Playgroud)