We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

sfDataGRid Group

can this control create groups and summary of a one or more columns ?

5 Replies

DS Divakar Subramaniam Syncfusion Team August 11, 2016 09:29 AM UTC

 Hi Miguel,

Thank you for using Syncfusion Products.

SfDataGrid supports single column grouping in which you can group any column by adding the Group Description with “column name” to the GroupColumnDescription collection. You can refer the below UG link for know more about grouping in SfDataGrid.

Caption summary row will be created whenever you group a column in SfDataGrid. You can also customize the caption text in SfDataGrid. Refer the below UG link for more details regarding summary in SfDataGrid. 

Currently we do not have support for multi-grouping in SfDataGrid and have considered your request to be a feature. We have added it to our feature request list and it will be implemented in any of our upcoming releases. 

MA Miguel Arenas August 16, 2016 12:32 AM UTC

Thank you, I was able to create the Group.

Do the column have to be Int16, Int32, to be able sum?

DD Dharmendar Dhanasekar Syncfusion Team August 16, 2016 12:05 PM UTC

Hi Miguel,

Thanks for the update.Yes, the underlying property associated with the column must be of any numeric type to apply the sum.. You can set summary type as either Int32Aggregate or DoubleAggregate.

GridSummaryRow summaryRow = new GridSummaryRow(); 
summaryRow.Title = "Sum :{CaptionSummary}"; 
summaryRow.ShowSummaryInRow = true; 
    new GridSummaryColumn() 
        Name = "CaptionSummary", 
        MappingName = "Mark1", 
        Format = "{Sum} ", 
        SummaryType = SummaryType.Int32Aggregate 
dataGrid.CaptionSummaryRow = summaryRow; 

We have prepared sample based on this and please download sample from the below link.

Sample link : http://www.syncfusion.com/downloads/support/forum/125365/ze/GroupCaptionDemo-247665733


MA Miguel Arenas August 16, 2016 04:16 PM UTC

Do the field has to be int32?

DS Divakar Subramaniam Syncfusion Team August 17, 2016 10:54 AM UTC

Hi Miguel,   
The underlying property and the field associated to it can be of any numeric type. You do not need to explicitly specify it as Int32. It has to be of numeric type like int or double.    
You can set summary type as either Int32Aggregate or DoubleAggregate based on your requirement to calculate the summary.   
private double mark2;   
public double Mark2   
    get { return mark2; }   
    set { this.mark2 = value; }   
GridSummaryRow summaryRow = new GridSummaryRow();   
summaryRow.Title = "Total Items:{CaptionSummary}";   
summaryRow.ShowSummaryInRow = true;   
new GridSummaryColumn()   
     Name = "CaptionSummary",   
     MappingName = "Mark2",   
     Format = "{Sum} ",   
     SummaryType = SummaryType.Int32Aggregate   
dataGrid.CaptionSummaryRow = summaryRow;   
In above code example, the underlying property is of type double and summary type for it isInt32Aggregate. Here the double values will be rounded off to integer values based on the summary type Int32Aggregate. By the same way, you can use field with Int32 values and summary type as DoubleAggregate.   
We have modified the same in the sample for your reference and you can download it from the below link,   

Live Chat Icon For mobile
Up arrow icon