This is a migrated thread and some comments may be shown as answers.

Edit Form's Grid's Double-click Event Bubbles to Parent Grid

1 Answer 103 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Ed Tischofer
Top achievements
Rank 1
Ed Tischofer asked on 26 Aug 2008, 02:44 PM
I have a heirarchical RadGrid on a page that uses the client-side double-click event to place the grid into edit mode.  When in edit mode, a web user control edit form is displayed.  The edit form contains an additional heirarchical RadGrid that too uses the client-side double-click event to place the grid into edit mode.

The problem that I am experiencing is that the client-side double-click event of the edit form grid is being propagated to the parent grid.  Would someone please explain why this is happening, and what I can do about it?

Thank you,

Chris

1 Answer, 1 is accepted

Sort by
0
Veli
Telerik team
answered on 28 Aug 2008, 10:34 AM
Hi Chris,

This is expected RadGrid behavior, as the client event bubbles up the container elements. The approach you can take to solve the issue is to retrieve the <tr> element you have double clicked and check its client ID. Nested <tr> elements of nested RadGrids contain the ClientID's of both parent RadGrids - the inner and outer. You can check to see if the inner RadGrid ID exists as a substring in the client ID of the <tr> element, and if true, cancel the event for the parent grid. Here is the required javascript:

RowDblClick1 is the parent RadGrid double click event handler, where RowDblClick2 is inner RadGrid's:

var rowID; 
function RowDblClick1(sender, args) 
    if(rowID == null || rowID.indexOf('RadGrid2') == -1) 
    { 
        alert('Click1');  //you can successfully call edit command for parent grid 
    } 
function RowDblClick2(sender, args) 
    rowID = sender.get_masterTableView().get_dataItems()[args.get_itemIndexHierarchical()]._element.id; 
    alert('Click2'); 

What the above code does is set a global variable to the ID of the <tr> element from the child RadGrid. In the parent grid's double click event we check this value. If we make sure that this variable is either not set, or does not contains child grid's ID, we can safely proceed. This, we cancel any events initiated in the child grid.

Best wishes,
Veli
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Tags
Grid
Asked by
Ed Tischofer
Top achievements
Rank 1
Answers by
Veli
Telerik team
Share this question
or