Iterate over Selected Parent rows child rows example

2 posts, 0 answers
  1. Greg
    Greg avatar
    28 posts
    Member since:
    Dec 2014

    Posted 28 Apr 2015 Link to this post

    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

  2. Dimiter Madjarov
    Admin
    Dimiter Madjarov avatar
    2303 posts

    Posted 30 Apr 2015 Link to this post

    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.

     
Back to Top