:: Forum >>

V2 - grid onClick event bubbling

Hi there,

I'm implementing a grid with expandable rows where a new sub-grid is opened when I click on a grid row. I'm basing it on the example code written by Andres some time ago for V1 of the grid. In Andres' example a grid row is expanded when the user clicks on a + image in the first column. However, I'm implementing the expand when the user clicks anywhere on the grid row. So, I override the onRowClicked event of the grid.

The problem is when I click on a grid row in the new sub-grid the onClick event is picked up by both the sub-grid and the parent grid....even though I cancel bubbling of the event in the sub-grid. The effect is that the expanded row (or sub-grid) is collapsed because the parent grid picks up a mouse click, determines that the row has already been expanded and so toggles the expand state (i.e. collapses the grid row)

This is the function used to cancel bubbling of the event:
function _noBubbling(e){
    if (document.all) {
        window.event.cancelBubble = true;
        window.event.returnValue = false;
    }else if(e.preventDefault){
        e.cancelBubble = true;
        e.stopPropagation();
        e.preventDefault();
    }
    return false;
}


Is there something I'm missing here in terms of events in general or something specific to AW grid events?
I can post the expand row code also if necessary but I think it's quite similar to the code here:
http://www.activewidgets.com/javascript.forum.4452.7/this-is-a-great-example.html

Thanks in advance for any help.
BT
BT
Tuesday, January 3, 2006

This topic is archived.


Back to support forum

Forum search