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

Getting Grouped rows

3 Answers 1044 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Scott
Top achievements
Rank 1
Scott asked on 23 Nov 2015, 11:14 PM

I have some Grouped rows.

 

How do I go about obtaining the "children" rows of the groups?

Thank you.

 

3 Answers, 1 is accepted

Sort by
0
Radoslav
Telerik team
answered on 25 Nov 2015, 08:02 AM
Hello Scott,

Could you please elaborate a bit more on your scenario? What do you try to achieve? If you want to get DOM elements of all group rows and the corresponding data rows you can find all rows in the grid and iterate over them. When the row has class k-grouping-row it is a group header, all rows till the next row with class k-grouping-row will be the data rows corresponding to the header row.

Please give the suggestions try and let me know if it helps you.

Looking forward for your reply.

Regards,
Radoslav
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
0
Scott
Top achievements
Rank 1
answered on 25 Nov 2015, 03:56 PM

Thanks for the reply, but this does not help solve my requirement.

 Basically, I am trying to solve the issue from this posting.

In essence, if a GROUP is dragged-dropped, I need to identify ONLY it's children, then move the children along with it.  If I iterate all rows (as you suggested), this does not help because I will have no idea which group was moved.

Rows seem to have a unique identifier (uid), but Groups do not.  This would make life much easier if it existed.  Until then, I am open for suggestions and hopeful that there is some kind of workaround.  Any help appreciated.

 

0
Radoslav
Telerik team
answered on 26 Nov 2015, 07:53 AM
Hello Scott,

You can try using following approach for getting the group header row with corresponding data rows: In dataBound event find each header row and corresponding data rows and add name attribute with some value:
dataBound: function(e) {
    var rows = e.sender.element.find("tbody > .k-grouping-row");
    for(var i=0; i< rows.length; i++)
    {
          $(rows[i]).attr("name",i);
         // Find all rows corresponding to this group and add the same name attribute.
     }
},

Then in the change event handler you can get the name value and find with jquery all corresponding rows:
change: function (e) {
    var name = e.item.attr("name");
    
    // Find all rows with this name
}

I hope this helps.

Regards,
Radoslav
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
Tags
Grid
Asked by
Scott
Top achievements
Rank 1
Answers by
Radoslav
Telerik team
Scott
Top achievements
Rank 1
Share this question
or