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.
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++;
}