[C#]
dataGrid.GroupColumnDescriptions.Add(new GroupColumnDescription()
{
ColumnName = "OrderID"
});
GridSummaryRow summaryRow = new GridSummaryRow();
summaryRow.Title = "Short Description : {CaptionSummary}";
summaryRow.ShowSummaryInRow = true;
summaryRow.SummaryColumns.Add(new GridSummaryColumn
{
Name = "CaptionSummary",
// Defining Custom Aggregate.
CustomAggregate = new CustomAggregate(),
MappingName = "OrderID",
Format = "{CustomString}",
SummaryType = Syncfusion.Data.SummaryType.Custom
});
dataGrid.CaptionSummaryRow = summaryRow;
// Aggregate class.
public class CustomAggregate : ISummaryAggregate
{
public CustomAggregate()
{
}
public string CustomString { get; set; }
public Action<System.Collections.IEnumerable, string, PropertyInfo> CalculateAggregateFunc()
{
return (items, property, pd) =>
{
var enumerableItems = items as IEnumerable<OrderInfo>;
if (pd.Name == "CustomString")
{
var value = enumerableItems.First<OrderInfo>().Customer;
var count = enumerableItems.Count();
this.CustomString = value.ToString() + "-" + count + " Items";
}
};
}
} |
Hi Paul,Thank you for update.We checked your requirement “How to display another column detail in caption summary row” and prepared sample based on your requirement. We have Grouped OrderID column and displayed Cutomer Column details in caption summary row. Please refer the following code snippet for your reference,
[C#]dataGrid.GroupColumnDescriptions.Add(new GroupColumnDescription(){ColumnName = "OrderID"});GridSummaryRow summaryRow = new GridSummaryRow();summaryRow.Title = "Short Description : {CaptionSummary}";summaryRow.ShowSummaryInRow = true;summaryRow.SummaryColumns.Add(new GridSummaryColumn{Name = "CaptionSummary",// Defining Custom Aggregate.CustomAggregate = new CustomAggregate(),MappingName = "OrderID",Format = "{CustomString}",SummaryType = Syncfusion.Data.SummaryType.Custom});dataGrid.CaptionSummaryRow = summaryRow;// Aggregate class.public class CustomAggregate : ISummaryAggregate{public CustomAggregate(){}public string CustomString { get; set; }public Action<System.Collections.IEnumerable, string, PropertyInfo> CalculateAggregateFunc(){return (items, property, pd) =>{var enumerableItems = items as IEnumerable<OrderInfo>;if (pd.Name == "CustomString"){var value = enumerableItems.First<OrderInfo>().Customer;var count = enumerableItems.Count();this.CustomString = value.ToString() + "-" + count + " Items";}};}}We have also prepared sample and attached in following reference.We hope this helps. Please lets us know, if you need further assistance.Regards,
Subburaj Pandian V