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

Group summary at Top

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?

3 Replies

MK Muthukumar Kalyanasundaram Syncfusion Team July 24, 2017 07:05 PM UTC

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 



FA Fabrizio Alessandro July 25, 2017 01:10 PM UTC

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.



MK Muthukumar Kalyanasundaram Syncfusion Team July 27, 2017 01:25 PM UTC

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 


Loader.
Up arrow icon