BootstrapGridViewBuilderBase<T>.GroupSummary(Action<BootstrapSummaryItemCollectionBuilder>) Method
Provides access to group summary items.
Namespace: DevExpress.AspNetCore.Bootstrap
Assembly: DevExpress.AspNetCore.Bootstrap.v18.2.dll
#Declaration
public T GroupSummary(
Action<BootstrapSummaryItemCollectionBuilder> config
)
#Parameters
Name | Type | Description |
---|---|---|
config | Action<Bootstrap |
An Action that configures the Bootstrap |
#Returns
Type | Description |
---|---|
T | A reference to this instance after the operation is completed. |
#Remarks
IMPORTANT
Bootstrap Controls for ASP.
$1 A group summary represents the summary value calculated within a single group and is displayed in the group row or group footer. The GroupSummary method adds a group summary item to the group footer.
The FieldName
method to specify a data field which will be used to perform summary calculating.
There are five predefined aggregate functions that you can use to calculate summaries: Sum, Min, Max, Average, and Count. You can define the summary type for each summary item using the SummaryType method.
The example below demonstrates how to add Count-type and Sum-type group summaries to Grid View.
@model IEnumerable
@(Html.DevExpress()
.BootstrapGridView("grid")
.Settings(settings => settings.ShowGroupPanel(true))
.KeyFieldName("OrderID")
.Columns(columns => {
columns
.Add()
.FieldName("Country")
.GroupIndex(0);
columns
.Add()
.FieldName("City")
.GroupIndex(1);
columns
.Add()
.FieldName("CompanyName");
columns
.Add()
.FieldName("Region");
columns
.AddTextColumn()
.FieldName("UnitPrice")
.PropertiesTextEdit(properties => properties.DisplayFormatString("c"));
columns
.Add()
.FieldName("Quantity");
columns
.AddTextColumn()
.FieldName("Total")
.UnboundType(UnboundColumnType.Decimal)
.UnboundExpression("UnitPrice * Quantity")
.PropertiesTextEdit(properties => properties.DisplayFormatString("c"));
})
.GroupSummary(summary => {
summary
.Add()
.FieldName("Total")
.SummaryType(SummaryItemType.Sum);
summary
.Add()
.FieldName("CompanyName")
.SummaryType(SummaryItemType.Count);
})
.Routes(routes => routes
.MapRoute(r => r
.Controller("GridView")
.Action("GroupSummary")))
.Bind(Model))