Skip to main content

DevExpress v24.1 Update — Your Feedback Matters

Our What's New in v24.1 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

Take the survey Not interested

DxGrid.GetGroupSummaryDisplayText(IGridSummaryItem, Int32) Method

Gets a group summary item’s display text.

Namespace: DevExpress.Blazor

Assembly: DevExpress.Blazor.v24.1.dll

NuGet Package: DevExpress.Blazor

#Declaration

C#
public string GetGroupSummaryDisplayText(
    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 item’s display text.

#Remarks

Specify the DisplayText property or handle the CustomizeSummaryDisplayText event to customize the summary display text.

Note

The Grid bound to an Instant Feedback Data Source or GridDevExtremeDataSource loads data asynchronously in small portions (instead of the entire dataset). Before you call the GetGroupSummaryDisplayText method, call the WaitForRemoteSourceRowLoadAsync(Int32) method to ensure that the specified data row is loaded.

The following code snippet customizes group rows. These rows contain group field values and summary values that are formatted in italics.

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

<DxGrid Data="@Data"
        ShowGroupPanel="true"
        CustomizeSummaryDisplayText="Grid_CustomizeSummaryDisplayText">
    <Columns>
        <DxGridDataColumn FieldName="Country" GroupIndex="0" Width="200px">
            <GroupRowTemplate>
                <text>@context.DataColumn.FieldName : @context.GroupValue</text>
                @{
                    var summaryItems = context.Grid.GetGroupSummaryItems();
                    if (summaryItems.Any())
                    {
                        <text> (</text>
                        foreach (var i in summaryItems)
                        {
                            <i>@context.Grid.GetGroupSummaryDisplayText(i, context.VisibleIndex)</i>
                        }
                        <text>)</text>
                    }
                }
            </GroupRowTemplate>
        </DxGridDataColumn>
        <DxGridDataColumn FieldName="City" />
        <DxGridDataColumn FieldName="OrderDate" Width="200px" />
        <DxGridDataColumn FieldName="UnitPrice" DisplayFormat="c" Width="120px" />
        <DxGridDataColumn FieldName="Quantity" Width="120px" />
    </Columns>
    <GroupSummary>
        <DxGridSummaryItem SummaryType="GridSummaryItemType.Count" FieldName="Country" />
    </GroupSummary>
</DxGrid>
@* ... *@
@code {
    object Data { get; set; }
    NorthwindContext Northwind { get; set; }
    IGrid Grid1 { get; set; }
    @* ... *@
    protected override void OnInitialized() {
        Northwind = NorthwindContextFactory.CreateDbContext();
        Data = Northwind.Invoices
            .ToList();
    }

    void Grid_CustomizeSummaryDisplayText(GridCustomizeSummaryDisplayTextEventArgs e) {
        e.DisplayText = string.Format("Count of Orders : {0}", e.Value);
    }

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

DevExpress Blazor Grid - Group Summary

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

See Also