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

Iterate over Selected Parent rows child rows example

1 Answer 253 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Greg
Top achievements
Rank 1
Greg asked on 28 Apr 2015, 03:51 PM

I have a Parent/Child grid.  For the rows selected I need to get the Parent and child rows data.

 

I don't see any examples.  Can someone point me to one?

 

Thanks

 

Greg

1 Answer, 1 is accepted

Sort by
0
Dimiter Madjarov
Telerik team
answered on 30 Apr 2015, 07:46 AM

Hello Greg,

You could find the selected rows in the master Grid via their CSS classes - k-master-row and k-state-selected.
E.g.

var grid = $("#grid").data("kendoGrid");
var selected = grid.tbody.find("tr.k-master-row.k-state-selected");

Then you could check if the next row for each of them has the k-detail-row CSS class. This will mean that the corresponding detail row has been expanded at least once.
E.g.
selected.each(function(e){
   var nextRow = $(this).next("tr");
   if(nextRow.hasClass("k-detail-row")){
      var childGrid = nextRow.find(".k-grid").data("kendoGrid");
      //access child Grid data
   }
})

Regards,
Dimiter Madjarov
Telerik
 

See What's Next in App Development. Register for TelerikNEXT.

 
Tags
Grid
Asked by
Greg
Top achievements
Rank 1
Answers by
Dimiter Madjarov
Telerik team
Share this question
or