GWT 2.5 DataGrid SelectionModel及其子系统
使用创建行和子行时,选择模型未按预期工作。 当单击子视图的复选框时,该行未被选中,但父行变为选中 我试图重载以手动处理选择,但似乎DataGrid本身在按下checkboxcell时触发选择事件 如果行和子行来自同一类型,如何添加同时支持行和子行的选择模型GWT 2.5 DataGrid SelectionModel及其子系统,gwt,celltable,selectionmodel,gwt-2.5,Gwt,Celltable,Selectionmodel,Gwt 2.5,使用创建行和子行时,选择模型未按预期工作。 当单击子视图的复选框时,该行未被选中,但父行变为选中 我试图重载以手动处理选择,但似乎DataGrid本身在按下checkboxcell时触发选择事件 如果行和子行来自同一类型,如何添加同时支持行和子行的选择模型 @Override public void onBrowserEvent(Context context, Element elem, final T object, NativeEvent event) { // T
@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);
}
public void onBrowserEvent(上下文、元素元素、最终T对象、,
NativeEvent事件){
//提供的行始终是根行,因此我们需要找到
//在编辑子行时更正一个错误
实现索引=context.getSubIndex();
实际对象=对象;
if(0!=context.getSubIndex()&&RowDTO的对象实例){
实现索引=context.getSubIndex();
actualObject=(T)(RowDTO)object.getChild(actualIndex-1);
context=新上下文(context.getIndex(),context.getColumn(),
实际对象、实际索引);
}
ValueUpdater ValueUpdater=(getFieldUpdater()==null)?null
:new ValueUpdater(){
@凌驾
公共无效更新(C值){
getFieldUpdater().update(实现索引、对象、值);
}
};
getCell().onBrowserEvent(上下文、元素、getValue(actualObject)、事件、,
valueUpdater);
}
要添加一些impl吗?也许这将有助于刺激更多的帮助。