Skip to main content

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<BootstrapSummaryItemCollectionBuilder>

An Action that configures the BootstrapSummaryItemCollectionBuilder class.

Returns

Type Description
T

A reference to this instance after the operation is completed.

Remarks

IMPORTANT

Bootstrap Controls for ASP.NET Core are in maintenance mode. We don’t add new controls or develop new functionality for this product line. Our recommendation is to use the ASP.NET Core Controls suite.

$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))
See Also