<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>
|
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.
<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>
|
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;
}
}
|