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

Hierarchy telerik rad grid

1 Answer 117 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Dheeraj
Top achievements
Rank 1
Dheeraj asked on 12 Apr 2014, 10:36 PM
i am using hierarchy rad grid. In radgrid_itemcreated event i am checking if the griddata item is in the parent grid or in the child grid. How to i get the row index of parent grid in a child grid ?

I have hierarchy rad grid and checkboxes associated with each grid data row. if i select the top grid all child grid rows should be selected. if i select middle grid then the last grid rows should be selected.if i deselect any row in the child grid the parent rows should also be deselected.

i have my code where if i select top grid all child rows are selected. how can i achieve the same with the middle grid in the hierarchy.



function CheckBoxPackage_OnClick(obj, index) {
var grid = $find("<%= RadGrid1.ClientID%>");
var MasterTable = grid.get_masterTableView();
var row = MasterTable.get_dataItems()[index];
var detailView1 = row.get_nestedViews()[0];
for (var i = 0; i < detailView1.get_dataItems().length; i++) {
var cbOrder = detailView1.get_dataItems()[i].findElement("CheckBoxOrder");
cbOrder.checked = obj.checked;
for (var j = 0; j < detailView1.get_dataItems()[i].get_nestedViews()[0].get_dataItems().length; j++) {
var checkBox3 = detailView1.get_dataItems()[i].get_nestedViews()[0].get_dataItems()[j].findElement("CheckBoxOrderLine");
checkBox3.checked = obj.checked;

}

}
document.getElementById("<%= btnAssignCodes.ClientID%>").disabled = false;
}

 In the above code if top checkbox in the 3 levels of grid is selected all child are selected but if 2nd level grid checkbox is selected then 3rd level grid rows are not selected. please suggest .

thanks



1 Answer, 1 is accepted

Sort by
0
Accepted
Maria Ilieva
Telerik team
answered on 16 Apr 2014, 12:57 PM
Hi Dheeraj,

I suggest that you examine the following help article which shows how to get the primary key field for up-level rows using DataKeyNames/DataKeyValues:
Extracting primary key value for parent item in hierarchy on Update/Insert

Regards,
Maria Ilieva
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
Tags
Grid
Asked by
Dheeraj
Top achievements
Rank 1
Answers by
Maria Ilieva
Telerik team
Share this question
or