Skip to main content
A newer version of this page is available. .

DxGrid.GetGroupSummaryLabel(IGridSummaryItem, Int32) Method

Gets the name of a group summary‘s function name.

Namespace: DevExpress.Blazor

Assembly: DevExpress.Blazor.v23.1.dll

NuGet Package: DevExpress.Blazor

Declaration

public string GetGroupSummaryLabel(
    IGridSummaryItem item,
    int visibleIndex
)

Parameters

Name Type Description
item IGridSummaryItem

The group summary item.

visibleIndex Int32

The group row’s index.

Returns

Type Description
String

The group summary function’s name.

Remarks

You can handle the CustomizeSummaryDisplayText event to customize the summary display text.

The example below illustrates how to customize group rows. These rows contain the group field values and summary values that are formatted in bold.

@using Microsoft.EntityFrameworkCore
@inject IDbContextFactory<NorthwindContext> NorthwindContextFactory
@implements IDisposable

<DxGrid Data="@Data"
        ShowGroupPanel="true">
    <Columns>
        <DxGridDataColumn FieldName="Country" GroupIndex="0">
            <GroupRowTemplate>
                <text>@context.DataColumn.FieldName: @context.GroupValue</text>
                @{
                    var summaryItems = context.Grid.GetGroupSummaryItems();
                    if (summaryItems.Any()) {
                        <text> (</text>
                        foreach (var i in summaryItems) {
                            if (i != summaryItems.First()) {
                                <text>, </text>
                            }
                            @context.Grid.GetGroupSummaryLabel(i, context.VisibleIndex)
                            <text>: </text>
                            <b>@context.Grid.GetGroupSummaryFormattedValue(i, context.VisibleIndex)</b>
                        }
                        <text>)</text>
                    }
                }
            </GroupRowTemplate>
        </DxGridDataColumn>
        <DxGridDataColumn FieldName="City" />
        <DxGridDataColumn FieldName="OrderDate"/>
        <DxGridDataColumn FieldName="UnitPrice" DisplayFormat="c" />
        <DxGridDataColumn FieldName="Quantity" />
    </Columns>
    <GroupSummary>
        <DxGridSummaryItem SummaryType="GridSummaryItemType.Count" FieldName="Country" />
        <DxGridSummaryItem SummaryType="GridSummaryItemType.Max" FieldName="OrderDate" />
    </GroupSummary>
</DxGrid>

@code {
    object Data { get; set; }
    NorthwindContext Northwind { get; set; }

    protected override void OnInitialized() {
        Northwind = NorthwindContextFactory.CreateDbContext();
        Data = Northwind.Invoices
            .ToList();
    }

    public void Dispose() {
        Northwind?.Dispose();
    }
}

Blazor Grid Group Row Template

Run Demo: Grid - Group Row Template

For more information about summaries in the Grid component, refer to the following topic: Summary in Blazor Grid.

See Also