DataGrid Rowspan for 1:Many Record Relationships

How can I setup the DataGrid so that it will rowspan for 1:Many record relationships?

Use Case: A report that has Contacts > Cases > Documents, where each of the sub-tables have a 1:Many relationship. (So, Contacts will span multiple Cases, which will span multiple Documents.)

The data is coming out flat as JSON from an API (SQL Query), and I can process it so that the relationships and rowspans are defined but how do you get the DataGrid to show this properly.

Thank you so much for your time.

Hey Vlad, Thanks so much for the quick reply.

How could I do the rowspan conditionally and dynamically based on the data in the following rows?

Like if the next row has the same rec_id for that column.

Check the code of the demo I’ve posted - it does literally that.

In your code you are using this to do the rowspan:
if (args.Data.OrderID == 10248 && args.Data.ProductID == 11 || args.Data.OrderID == 10250 && args.Data.ProductID == 41)
{
args.Attributes.Add("rowspan", 3);
}


But I want to do it like:
int rowspan = 1;
int index = args.Data.index;
if(args.Data[index+1] != null)
{
while(args.Data[index+1] != null && args.Data[index + 1].OrderID == args.Data.OrderID)
{
rowspan++;
index++;
}

if(rowspan > 1) args.Attributes.Add("rowspan", rowspan);

}


But how exactly can I traverse through the Data like that?

Thank you for taking the time to answer my questions.

Data is the data item. If you need to loop on some object all properties you can use reflection.