6

を使用TableBuilderして行とサブ行を作成すると、選択モデルが期待どおりに機能しません。サブ行のチェックボックスをクリックすると、その行は選択されませんが、代わりに親行が選択されます。

onBrowserEvent選択を手動で処理するためにのオーバーロードを試みましたCheckboxCellが、チェックボックスセルを押すとDataGrid自体が選択イベントを発生させるようです。

行とサブ行が同じタイプのものである場合、行とサブ行の両方をサポートする選択モデルを追加するにはどうすればよいですか?

4

1 に答える 1

0
@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);
}
于 2013-05-25T04:47:20.677 に答える