Group several columns at the same level

Hello.
Let's say that I have a grid to show my invoices including their lines.
The invoice would be something like
public class Invoice
{
     public int Id {get; set;}
     public string InvoiceNumber {get; set;}
     public string Name {get; set;}
     public DateTime InvoiceDate {get; set;}
     public decimal Amount {get; set;}
}
public class InvoiceLine
{
     public int Id {get; set;}
     public int InvoiceId {get; set;}
     public int LineOrder {get; set;}
     public string Description {get; set;}
     public decimal Amount {get; set;}
}
As result of the query I get a ViewModel like this which will be the datasource for the grid:
public class InvoiceViewModel
{
     public int InvoiceId {get; set;}
     public string InvoiceNumber {get; set;}
     public string Name {get; set;}
     public DateTime InvoiceDate {get; set;}
     public decimal Total {get; set;}
     public int LineId {get; set;}
     public int LineOrder {get; set;}
     public string Description {get; set;}
     public decimal LineAmount {get; set;}
}
I'd like the Invoice fields of my ViewModel to act as a unique grouping condition. I don't want to group by Invoice number, then by Date, then by name, and so on.
I want to have in the same line (with different styling) the InvoiceNumber, Date, Name and Amount. Something like the following image;


Thanks for the assistance


3 Replies

MF Mohammed Farook J Syncfusion Team September 28, 2018 12:33 PM UTC

Hi Toni, 

Thanks for contacting Syncfusion support. 

We have analyzed your query. But we are not certain about your exact requirement. We suspect that you may be requiring any of the following two suspected solutions. 

Suspected solution 1 : Use caption template and aggregates 
 
We suspect that your requirement is to customize the group caption. Then we suggest you to use the caption template and caption aggregate support of Grid. Please refer the documentation and online sample link below, 

 
Suspected solution 2 : Expecting a Syncfusion TreeGrid Component like behavior 
 
While analyzing your requirement, we could see that your requirement relates to the Syncfusion TreeGrid component. Are you expecting a behavior/requirement as like the TreeGrid component? Please refer the below documentation and online sample link and confirm whether your requirement is same as the TreeGrid behavior or not. 

 
If we have misunderstood your requirement. Please get back to us the following details for better assistance. 

 
  1. Share with us a detailed explanation your exact requirement.
  2. When multiple columns are grouped in Grid, it will show as like a hierarchy, as shown in below screenshot. Is your requirement is to remove this hierarchy like display and show the grouped columns information in a single line?

 

Please get back to us if you need further assistance. 

Regards, 
J Mohammed Farook 
 



TO Toni September 28, 2018 12:45 PM UTC

Your last approach is the more accurate to my requirements.

I would like the grouping columns (in your sample, Investor Name and Country) in the same column, without hierarchy.


MF Mohammed Farook J Syncfusion Team October 8, 2018 12:00 PM UTC

Hi Toni, 
 
We have validated your requirement. But currently, Essential Javascript 2 Grid grouping architecture doesn't support grouping column at the same level. 
 
Regards, 
J Mohammed Farook  


Loader.
Up arrow icon