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. (Last updated on: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

SUMMARY FOR TWO OR MORE COLUMNS IN SINGLE ROW

Thread ID:

Created:

Updated:

Platform:

Replies:

147878 Sep 26,2019 04:52 PM UTC Sep 27,2019 08:46 AM UTC WinForms 1
loading
Tags: SfDataGrid
Deepak
Asked On September 26, 2019 04:52 PM UTC

Dear Sir,

In My SFDATAGRID, I have more then 2 Columns as Numbers, I want Summary for the same in single line. 

I am trying to do but getting the result in two separate row.

How to get the required result.

Thanks
Deepak

Farjana Parveen Ayubb [Syncfusion]
Replied On September 27, 2019 08:46 AM UTC

Hi Deepak, 
 
Thank you for using Syncfusion controls. 
 
You can able to add the summary for more than one column in single summary row by adding more number of SummaryColumn. Please find the below code example 
 
ShowSummaryInRow = True 
 
//Creating Summary Columns 
GridSummaryColumn summaryColumn1 = new GridSummaryColumn(); 
summaryColumn1.Name = "OrderID"; 
summaryColumn1.SummaryType = SummaryType.CountAggregate; 
summaryColumn1.Format = "{Count}"; 
summaryColumn1.MappingName = "OrderID"; 
 
GridSummaryColumn summaryColumn2 = new GridSummaryColumn(); 
summaryColumn2.Name = "Price"; 
summaryColumn2.SummaryType = SummaryType.DoubleAggregate; 
summaryColumn2.Format = "{Sum}"; 
summaryColumn2.MappingName = "UnitPrice"; 
 
GridSummaryColumn summaryColumn3 = new GridSummaryColumn(); 
summaryColumn3.Name = "Quantity"; 
summaryColumn3.SummaryType = SummaryType.DoubleAggregate; 
summaryColumn3.Format = "{Average}"; 
summaryColumn3.MappingName = "Quantity"; 
 
//TableSummary Row 
GridTableSummaryRow tableSummaryRow1 = new GridTableSummaryRow(); 
tableSummaryRow1.Name = "TableSummary"; 
tableSummaryRow1.ShowSummaryInRow = true; 
tableSummaryRow1.Title = " Table Summary: Count - {OrderID} - Price - {Price} - Avg Quantity - {Quantity}"; 
tableSummaryRow1.Position = VerticalPosition.Bottom; 
 
tableSummaryRow1.SummaryColumns.Add(summaryColumn1); 
tableSummaryRow1.SummaryColumns.Add(summaryColumn2); 
tableSummaryRow1.SummaryColumns.Add(summaryColumn3); 
this.sfDataGrid.TableSummaryRows.Add(tableSummaryRow1); 
 
//GroupSummary Row 
GridSummaryRow groupSummaryRow1 = new GridSummaryRow(); 
groupSummaryRow1.Name = "GroupSummary"; 
groupSummaryRow1.ShowSummaryInRow = true; 
groupSummaryRow1.Title = "Group Summary: Count - {OrderID} - Price - {Price} - Avg Quantity - {Quantity}"; 
 
groupSummaryRow1.SummaryColumns.Add(summaryColumn1); 
groupSummaryRow1.SummaryColumns.Add(summaryColumn2); 
groupSummaryRow1.SummaryColumns.Add(summaryColumn3); 
this.sfDataGrid.GroupSummaryRows.Add(tableSummaryRow1); 
 
//CaptionSummary Row 
GridSummaryRow captionSummaryRow = new GridSummaryRow(); 
captionSummaryRow.Name = "CaptionSummary"; 
captionSummaryRow.ShowSummaryInRow = true; 
captionSummaryRow.Title = "Caption Summary: Count - {OrderID} - Price - {Price} - Avg Quantity - {Quantity}"; 
 
captionSummaryRow.SummaryColumns.Add(summaryColumn1); 
captionSummaryRow.SummaryColumns.Add(summaryColumn2); 
captionSummaryRow.SummaryColumns.Add(summaryColumn3); 
this.sfDataGrid.CaptionSummaryRow = captionSummaryRow; 
 
 
 
ShowSummaryInRow = False 
 
//Creating Summary Columns 
GridSummaryColumn summaryColumn1 = new GridSummaryColumn(); 
summaryColumn1.Name = "OrderID"; 
summaryColumn1.SummaryType = SummaryType.CountAggregate; 
summaryColumn1.Format = "{Count}"; 
summaryColumn1.MappingName = "OrderID"; 
 
GridSummaryColumn summaryColumn2 = new GridSummaryColumn(); 
summaryColumn2.Name = "Price"; 
summaryColumn2.SummaryType = SummaryType.DoubleAggregate; 
summaryColumn2.Format = "{Sum}"; 
summaryColumn2.MappingName = "UnitPrice"; 
 
GridSummaryColumn summaryColumn3 = new GridSummaryColumn(); 
summaryColumn3.Name = "Quantity"; 
summaryColumn3.SummaryType = SummaryType.DoubleAggregate; 
summaryColumn3.Format = "{Average}"; 
summaryColumn3.MappingName = "Quantity"; 
 
//TableSummary Row 
GridTableSummaryRow tableSummaryRow1 = new GridTableSummaryRow( 
tableSummaryRow1.Name = "TableSummary"; 
tableSummaryRow1.ShowSummaryInRow = false; 
tableSummaryRow1.Position = VerticalPosition.Bottom; 
 
tableSummaryRow1.SummaryColumns.Add(summaryColumn1); 
tableSummaryRow1.SummaryColumns.Add(summaryColumn2); 
tableSummaryRow1.SummaryColumns.Add(summaryColumn3); 
this.sfDataGrid.TableSummaryRows.Add(tableSummaryRow1); 
 
//GroupSummary Row 
GridSummaryRow groupSummaryRow1 = new GridSummaryRow(); 
groupSummaryRow1.Name = "GroupSummary"; 
groupSummaryRow1.ShowSummaryInRow = false; 
 
groupSummaryRow1.SummaryColumns.Add(summaryColumn1); 
groupSummaryRow1.SummaryColumns.Add(summaryColumn2); 
groupSummaryRow1.SummaryColumns.Add(summaryColumn3); 
this.sfDataGrid.GroupSummaryRows.Add(tableSummaryRow1); 
 
//CaptionSummary Row 
GridSummaryRow captionSummaryRow = new GridSummaryRow(); 
captionSummaryRow.Name = "CaptionSummary"; 
captionSummaryRow.ShowSummaryInRow = false; 
 
captionSummaryRow.SummaryColumns.Add(summaryColumn1); 
captionSummaryRow.SummaryColumns.Add(summaryColumn2); 
captionSummaryRow.SummaryColumns.Add(summaryColumn3); 
this.sfDataGrid.CaptionSummaryRow = captionSummaryRow; 
 
 
 
 
Please let us know if you need any further details on this. 
 
Regards, 
Farjana Parveen A 


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon