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.
Unfortunately, activation email could not send to your email. Please try again.

Group summary at Top

Thread ID:

Created:

Updated:

Platform:

Replies:

131664 Jul 21,2017 12:28 PM Jul 27,2017 09:25 AM WPF 3
loading
Tags: SfDataGrid
Fabrizio Alessandro
Asked On July 21, 2017 12:28 PM

Hello,

I would like to know if is possible to move the Group Summary from the bottom to the top of the "group view".
I have tried with the Caption Summary but I can't show the caption title and the summary at the same time.

Is possible to do this?

Muthukumar Kalyanasundaram [Syncfusion]
Replied On July 24, 2017 03:05 PM

Hi Fabrizio, 
 
Thank you for contacting Syncfusion support. 
 
We have checked your query. If you want to display summary information in row, then you have to set the GridSummaryRow.ShowSummaryInRow as true and defining summary columns. You can able to define GridSummaryRow.Title based on GridSummaryColumn.Name property for format summary columns values in row. For your reference, we have attached sample and documentation link in below location. Could you please refer to it. 
 
Code Snippet: 
 
<syncfusion:SfDataGrid.CaptionSummaryRow> 
    <syncfusion:GridSummaryRow Title="Total Sales in Year for {ProductCount} Products : {YearSales}" ShowSummaryInRow="True"> 
        <syncfusion:GridSummaryRow.SummaryColumns> 
            <syncfusion:GridSummaryColumn Name="YearSales" 
                                            Format="'{Sum:c}'" 
                                            MappingName="Total" 
                                            SummaryType="DoubleAggregate" /> 
            <syncfusion:GridSummaryColumn Name="ProductCount" 
                                            Format="'{Count:d}'" 
                                            MappingName="Name" 
                                            SummaryType="CountAggregate" /> 
        </syncfusion:GridSummaryRow.SummaryColumns> 
    </syncfusion:GridSummaryRow> 
</syncfusion:SfDataGrid.CaptionSummaryRow> 
 
 
 
For more details about Summaries, you can refer this link, 
 
Please let us know if you have any query. 
 
Regards, 
Muthukumar K 


Fabrizio Alessandro
Replied On July 25, 2017 09:10 AM

Hi, Thank you, but it is not exactly what I'm looking for.

I would like to put the grouped column value in the title, while the group summaries stay on the top of each column.


Muthukumar Kalyanasundaram [Syncfusion]
Replied On July 27, 2017 09:25 AM

Hi Fabrizio, 
 
Thanks for the update. 
 
We have checked your query. You can achieve your requirement to show the GroupSummaryCaption text with the grouped column for using the following code example, 
 
Code Snippet: Xaml 
 
<syncfusion:SfDataGrid.CaptionSummaryRow> 
      <syncfusion:GridSummaryRow ShowSummaryInRow="False" > 
          <syncfusion:GridSummaryRow.SummaryColumns> 
                <syncfusion:GridSummaryColumn Name="SQS1" 
                                                          Format="'{Count:c}'" 
                                                          MappingName="QS1" 
                                                          SummaryType="Int32Aggregate" /> 
                  <syncfusion:GridSummaryColumn Name="SQS1" 
                                                          Format="'{Count:c}'" 
                                                          MappingName="QS1" 
                                                          SummaryType="Int32Aggregate" /> 
                  <syncfusion:GridSummaryColumn Name="SQS2" 
                                                          Format="'{Count:c}'" 
                                                          MappingName="QS2" 
                                                          SummaryType="Int32Aggregate" /> 
                    <syncfusion:GridSummaryColumn Name="SQS3" 
                                                          Format="'{Count:c}'" 
                                                          MappingName="QS3" 
                                                          SummaryType="Int32Aggregate" /> 
                   <syncfusion:GridSummaryColumn Name="SQS4" 
                                                          Format="'{Count:c}'" 
                                                          MappingName="QS4" 
                                                          SummaryType="Int32Aggregate" /> 
             </syncfusion:GridSummaryRow.SummaryColumns> 
        </syncfusion:GridSummaryRow> 
</syncfusion:SfDataGrid.CaptionSummaryRow> 
 
 
Code Snippet: C# 
 
this.grid.CellRenderers.Remove("CaptionSummary");  
this.grid.CellRenderers.Add("CaptionSummary", new CaptionSummaryRenderer()); 
 
public class CaptionSummaryRenderer : GridCaptionSummaryCellRenderer 
{ 
    public override void OnUpdateEditBinding(DataColumnBase dataColumn, GridCaptionSummaryCell element, object dataContext) 
    { 
        base.OnUpdateEditBinding(dataColumn, element, dataContext); 
        var groupRecord = element.DataContext as Group; 
        if (groupRecord == null) 
            return; 
        var groupedColumn = this.GetGroupedColumn(groupRecord); 
        if (groupedColumn == null) 
            return; 
             
        if (element.Content == "") 
            element.Content = groupedColumn.HeaderText + ":" + groupRecord.Key; 
    } 
    private GridColumn GetGroupedColumn(Group group) 
    { 
        var groupDesc = this.DataGrid.View.GroupDescriptions[group.Level - 1] as ColumnGroupDescription; 
             
        foreach (var column in this.DataGrid.Columns) 
        { 
            if (column.MappingName == groupDesc.PropertyName) 
            { 
                return column; 
            } 
        } 
        return null; 
    } 
} 
 
 
 
Please let us know if you have any query. 
 
Regards, 
Muthukumar K 


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.

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.

;