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.
  1. #1
    Sencha User
    Join Date
    Mar 2012
    Posts
    13
    Vote Rating
    0
    igieon is on a distinguished road

      0  

    Default 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;
    }


    };

  2. #2
    Sencha User
    Join Date
    Mar 2012
    Posts
    13
    Vote Rating
    0
    igieon is on a distinguished road

      0  

    Default 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. #3
    Sencha - GXT Dev Team
    Join Date
    Feb 2009
    Location
    Minnesota
    Posts
    2,731
    Vote Rating
    90
    Colin Alworth is a glorious beacon of light Colin Alworth is a glorious beacon of light Colin Alworth is a glorious beacon of light Colin Alworth is a glorious beacon of light Colin Alworth is a glorious beacon of light

      0  

    Default


    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.

Thread Participants: 1

Tags for this Thread