-
29 Nov 2012 9:26 AM #1
RowExpander dosn't fire events on ContentCell
RowExpander dosn't fire events on ContentCell
RowExpander dosn't fire events on ContentCell.
Workaround:
this.tripGrid = new Grid<Trip>(tripStore, cm, tripGridView) {
@Override
protected Cell<?> handleEventForCell(Event event) {
final EventTarget eventTarget = event.getEventTarget();
if (!Element.is(eventTarget)) {
return null;
}
final Element target = event.getEventTarget().cast();
final int rowIndex = getView().findRowIndex(target);
final int colIndex = getView().findCellIndex(target, null);
final Trip value = getStore().get(rowIndex);
if (colIndex == -1 && rowIndex != -1 && getView().getRowBodyRowSpan() == 2) {
//ensure row expander
final Element rowBody = getView().getRowBody(getView().getRow(rowIndex));
Element p = target.getParentElement();
while (p != null && !rowBody.equals(p)) {
p = p.getParentElement();
}
if (p != null) {
//click on row expander body and rowExpander in collumn confgi defautl position 0
@SuppressWarnings("unchecked")
final RowExpander<Trip> config = (RowExpander<Trip>) ((RowExpander<?>) cm.getColumn(0));
final Context context = new Context(rowIndex, 0, getStore().getKeyProvider().getKey(value));
if (cellConsumesEventType(config.getContentCell(), event.getType())) {
config.getContentCell().onBrowserEvent(context, p, value, event, null);
}
}
}
final ColumnConfig<Trip, ?> config = cm.getColumn(colIndex);
final Element cellParent = getView().getCell(rowIndex, colIndex);
if (value != null && config != null && cellParent != null) {
final Context context = new Context(rowIndex, colIndex, getStore().getKeyProvider().getKey(value));
return fireEventToCell(event, event.getType(), cellParent.getFirstChildElement(), value, context, config);
}
if (colIndex == -1) {
}
return null;
}
};
-
30 Nov 2012 6:23 AM #2
Workaround
Workaround
Code:this.tripGrid = new Grid<Trip>(tripStore, cm, tripGridView) { @Override protected Cell<?> handleEventForCell(Event event) { final EventTarget eventTarget = event.getEventTarget(); if (!Element.is(eventTarget)) { return null; } final Element target = event.getEventTarget().cast(); final int rowIndex = getView().findRowIndex(target); final int colIndex = getView().findCellIndex(target, null); final Trip value = getStore().get(rowIndex); if (colIndex == -1 && rowIndex != -1 && getView().getRowBodyRowSpan() == 2) { //ensure row expander final Element rowBody = getView().getRowBody(getView().getRow(rowIndex)); Element p = target.getParentElement(); while (p != null && !rowBody.equals(p)) { p = p.getParentElement(); } if (p != null) { //click on row expander body and rowExpander in collumn confgi defautl position 0 @SuppressWarnings("unchecked") final RowExpander<Trip> config = (RowExpander<Trip>) ((RowExpander<?>) cm.getColumn(0)); final Context context = new Context(rowIndex, 0, getStore().getKeyProvider().getKey(value)); if (cellConsumesEventType(config.getContentCell(), event.getType())) { config.getContentCell().onBrowserEvent(context, p, value, event, null); } } } final ColumnConfig<Trip, ?> config = cm.getColumn(colIndex); final Element cellParent = getView().getCell(rowIndex, colIndex); if (value != null && config != null && cellParent != null) { final Context context = new Context(rowIndex, colIndex, getStore().getKeyProvider().getKey(value)); return fireEventToCell(event, event.getType(), cellParent.getFirstChildElement(), value, context, config); } if (colIndex == -1) { } return null; } };
-
3 Dec 2012 5:39 PM #3
Thanks for the report and for the workaround. This appears to have been an oversight when the RowExpander was put together, and any fix should be made general enough to support RowExpander or any external class that hooks into the Grid to draw new rows.
You found a bug! We've classified it as
EXTGWT-2653
.
We encourage you to continue the discussion and to find an acceptable workaround while we work on a permanent fix.


Reply With Quote