Skip to main content

DxSummaryItemBase<TModel>.SummaryType Property

Specifies the summary function type.

Namespace: DevExpress.Blazor

Assembly: DevExpress.Blazor.v24.1.dll

NuGet Package: DevExpress.Blazor

Declaration

[DefaultValue(SummaryItemType.None)]
[Parameter]
public SummaryItemType SummaryType { get; set; }

Property Value

Type Default Description
SummaryItemType None

A SummaryItemType enumeration value.

Available values:

Name Description
None

Does not calculate the summary.

Sum

Calculates the sum across the entire grid or individual groups.

Min

Calculates the minimum across the entire grid or individual groups.

Max

Calculates the maximum value across the entire grid or individual groups.

Avg

Calculates the average of all the values within the entire grid or individual groups.

Count

Counts the number of rows within the entire grid or individual groups.

Remarks

To calculate a total or group summary in the Data Grid, add a DxDataGridSummaryItem object to the TotalSummary or GroupSummary collection. Use the item’s SummaryType property to specify an aggregate function.

The Avg, Min, Max, and Sum functions require that you set the Field property to a data field whose values are used in calculations. The Min and Max functions require a numeric or date-time data field. The Avg and Sum functions work with numeric fields only.

The Count function does not process any field values. If you select this function, use either the Field or ShowInColumn property to specify which column displays the number of rows.

<DxDataGrid Data="@Orders">
    <Columns>
        <DxDataGridDateEditColumn Field="@nameof(Order.OrderDate)" Width="240px" />
        <DxDataGridComboBoxColumn Field="@nameof(Order.CountryId)"
                                  Caption="Ship Country"
                                  Data="@Countries"
                                  ValueFieldName="@nameof(Country.Id)"
                                  TextFieldName="@nameof(Country.CountryName)"
                                  FilteringMode="DataGridFilteringMode.Contains"
                                  Width="250px" />
        <DxDataGridColumn Field="@nameof(Order.Product)" />
        <DxDataGridSpinEditColumn Field="@nameof(Order.UnitPrice)"
                                  DisplayFormat="c"
                                  Width="120px" />
    </Columns>
    <TotalSummary>
        <DxDataGridSummaryItem Field=@nameof(Order.OrderDate)
                               SummaryType=SummaryItemType.Min
                               DisplayFormat="First: {0:M}" />
        <DxDataGridSummaryItem Field=@nameof(Order.OrderDate)
                               SummaryType=SummaryItemType.Max
                               DisplayFormat="Last: {0:M}" />
        <DxDataGridSummaryItem Field=@nameof(Order.UnitPrice)
                               SummaryType=SummaryItemType.Sum
                               DisplayFormat="Sum: {0:c}" />
        <DxDataGridSummaryItem Field=@nameof(Order.UnitPrice)
                               SummaryType=SummaryItemType.Avg
                               DisplayFormat="Avg: {0:c}" />
        <DxDataGridSummaryItem ShowInColumn=@nameof(Order.CountryId)
                               SummaryType=SummaryItemType.Count />
    </TotalSummary>
</DxDataGrid>

Data Grid Summary Functions

Run Demo: Data Grid - Summary

See Also