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

need your help with grid client api

2 Answers 39 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Arsalan
Top achievements
Rank 1
Arsalan asked on 10 Jun 2012, 04:52 PM
okai i am following a tutorial on rad grid  using hierarchies  , so when  on command event is triggered from the nested table  i want to get a reference to the parent row that contains this nested table i am pasting the logic that is used in the tutorial , but its rather very complicated


function RadGrid2_Command(sender, args) {

   ordersView = sender.get_masterTableView();
    var nestedViewItem = sender.get_element().parentNode.parentNode;
    var parentGridDataItem = $find(Telerik.Web.UI.Grid.GetNodePreviousSiblingByTagName(nestedViewItem, "tr").id);
    var customerID = parentGridDataItem.getDataKeyValue("CustomerID");


    args.set_cancel(true);

    ordersCommandName = args.get_commandName();

    WebService.GetOrdersByCustomerID(customerID, ordersView.get_currentPageIndex() * ordersView.get_pageSize(), ordersView.get_pageSize(),
                    ordersView.get_sortExpressions().toString(), ordersView.get_filterExpressions().toDynamicLinq(),
                        updateOrdersGrid);
}

but why cant i use 
   var c = sender.get_masterTableView().get_parentRow();
method ?, its returning null  when i use it in the on command event  , and if any one of you can please explain me the logic behind the on command event that i have pasted , i will be much grateful!!!

2 Answers, 1 is accepted

Sort by
0
Arsalan
Top achievements
Rank 1
answered on 12 Jun 2012, 06:04 AM
come on guys !! i need little help here !!!
0
Galin
Telerik team
answered on 14 Jun 2012, 07:21 AM
Hello,

You can easily get the parent row of the nested table with the following js
sender.get_element().parentNode.parentNode

I hope this helps.

Regards,
Galin
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
Tags
Grid
Asked by
Arsalan
Top achievements
Rank 1
Answers by
Arsalan
Top achievements
Rank 1
Galin
Telerik team
Share this question
or