Skip to main content

DxGrid.TotalSummary Property

Contains total summary items.

Namespace: DevExpress.Blazor

Assembly: DevExpress.Blazor.v23.2.dll

NuGet Package: DevExpress.Blazor

Declaration

[Parameter]
public RenderFragment TotalSummary { get; set; }

Property Value

Type Description
RenderFragment

A collection of total summary items (UI fragment) that the browser renders in the grid’s markup.

Remarks

The DxGrid calculates total summary values across all records and displays these values in the footer. To create the total summary, declare a DxGridSummaryItem object in the TotalSummary template and specify the SummaryType and FieldName properties.

You can set the SummaryType property to Custom and handle the CustomSummary event to create a custom summary item.

The example below demonstrates how to create total summaries:

<DxGrid Data="@Data"
        SizeMode="Params.SizeMode" 
        KeyboardNavigationEnabled="true">
    <Columns>
        <DxGridDataColumn FieldName="CompanyName" MinWidth="100" />
        <DxGridDataColumn FieldName="City" Width="10%" />
        <DxGridDataColumn FieldName="Region" Width="10%" />
        <DxGridDataColumn FieldName="Country" Width="10%" />
        <DxGridDataColumn FieldName="UnitPrice" DisplayFormat="c" Width="10%" />
        <DxGridDataColumn FieldName="Quantity" MinWidth="80" Width="10%" />
        <DxGridDataColumn FieldName="Total"
                          UnboundType="GridUnboundColumnType.Decimal"
                          UnboundExpression="[UnitPrice] * [Quantity]"
                          DisplayFormat="c"
                          MinWidth="100"
                          Width="15%" />
    </Columns>
    <TotalSummary>
        <DxGridSummaryItem SummaryType="GridSummaryItemType.Count" FieldName="CompanyName" />
        <DxGridSummaryItem SummaryType="GridSummaryItemType.Min" FieldName="Quantity" />
        <DxGridSummaryItem SummaryType="GridSummaryItemType.Avg" FieldName="Quantity" ValueDisplayFormat="0.00" />
        <DxGridSummaryItem SummaryType="GridSummaryItemType.Max" FieldName="Quantity" />
        <DxGridSummaryItem SummaryType="GridSummaryItemType.Sum" FieldName="Total" />
    </TotalSummary>
</DxGrid>

DevExpress Blazor Grid - Total Summary

Run Demo: Grid - Total Summary Watch Video: Grid - Summary

Use the following API members to modify display text strings of total summary items:

ValueDisplayFormat
Specifies format pattern for the summary value.
DisplayText
Specifies display text pattern for the summary item. A display text string can include static text and placeholders for summary value and column caption.
CustomizeSummaryDisplayText
Handle this event to customize display text for an individual calculated summary value. The Grid event argument allows you to obtain information about the Grid’s current state and add this information to a summary item’s display text.

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

See Also