Configuring Grouping with Summaries (igHierarchicalGrid)
Demonstrates, with code examples, the various ways to configure summary values calculation with the igHierarchicalGrid™ control’s Grouping feature.
The following lists the topics required as a prerequisite to understanding this topic.
This topic contains the following sections:
The configurable aspects of the igGridGroupBy control related to its use in igHierarchicalGrid.
Configurable aspects | Details | Properties |
---|---|---|
The summary delimiter character | Use to define one or more characters acting as a delimiter between different summary functions displayed in group rows. | |
The summary format | Use to define a format string for the values of the summary function’s output. | |
The summary text before the summary | Use to define custom text to display on the group row before the summary values. |
|
The summary function(s) | Allows you to set any of various built-in summary functions like, row count, sum, average, minimum and maximum. Additionally, you can configure the name of a custom grouping comparer function for use when composing individual groups in the grid. |
|
The code snippet below activates the Grouping feature of a layout in an igHierarchicalGrid and applies the following settings related to summary values calculation and display:
In JavaScript:
Code: HTML and jQuery
...
features: [{
name: 'GroupBy',
inherit: true,
summarySettings: {
multiSummaryDelimiter: ", ",
summaryFormat: "#0.0"
},
columnSettings: [
{ columnKey: "Bin", isGroupBy: true },
{
columnKey: "Quantity",
summaries: [{
summaryFunction: "max",
text: "Max:"
}, {
summaryFunction: "custom",
text: "Delta:",
customSummary: summaryDelta
}]
}
]
}]
...
In ASPX:
Code: ASP.NET MVC
...
.Features(feature => {
feature.GroupBy().Inherit(true)
.SummarySettings(new GroupBySummarySettings {
SummaryFormat = "#0.0",
MultiSummaryDelimiter = ","
})
.ColumnSettings(setting =>
{
setting.ColumnSetting().ColumnKey("Bin").IsGroupBy(true);
setting.ColumnSetting().ColumnKey("Quantity").Summaries(summary =>
{
summary.Summary()
.Text("Max").SummaryFunction(SummaryFunction.Max);
summary.Summary()
.Text("Delta").SummaryFunction(SummaryFunction.Custom).CustomSummary("summaryDelta");
});
});
});
...
View on GitHub