Skip to main content

DxGrid.GetTotalSummaryDisplayText(IGridSummaryItem) Method

Gets a total summary item’s display text.

Namespace: DevExpress.Blazor

Assembly: DevExpress.Blazor.v24.2.dll

NuGet Package: DevExpress.Blazor

Declaration

public string GetTotalSummaryDisplayText(
    IGridSummaryItem item
)

Parameters

Name Type Description
item IGridSummaryItem

The total summary item.

Returns

Type Description
String

The total summary item’s display text.

Remarks

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

The following code snippet customizes the Unit Price column’s footer. The footer contains the summary’s display text that is formatted in italics.

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

<DxGrid Data="@Data"
        CustomizeSummaryDisplayText="Grid_CustomizeSummaryDisplayText">
    <Columns>
        <DxGridDataColumn FieldName="Country" />
        <DxGridDataColumn FieldName="City" />
        <DxGridDataColumn FieldName="OrderDate" />
        <DxGridDataColumn FieldName="UnitPrice" DisplayFormat="c" Width="150px">
            <FooterTemplate>
                @{
                    var summaryItems = context.Grid.GetTotalSummaryItems();
                    if (summaryItems.Any())
                    {
                        foreach (var i in summaryItems)
                        {
                            <i>@context.Grid.GetTotalSummaryDisplayText(i)</i>
                        }
                    }
                }
            </FooterTemplate>
        </DxGridDataColumn>
        <DxGridDataColumn FieldName="Quantity" />
    </Columns>
    <TotalSummary>
        <DxGridSummaryItem SummaryType="GridSummaryItemType.Max" FieldName="UnitPrice" />
    </TotalSummary>
</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("Max Price: {0}", e.Value);
    }

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

DevExpress Blazor Grid - Total Summary

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

See Also