Skip to main content
Tab

GridBatchEditSettings.EnableRealTimeSummaryRecalculation Property

Specifies whether the grid recalculates summaries on the client side.

Namespace: DevExpress.Web

Assembly: DevExpress.Web.v24.1.dll

NuGet Package: DevExpress.Web

Declaration

[DefaultValue(true)]
public bool EnableRealTimeSummaryRecalculation { get; set; }

Property Value

Type Default Description
Boolean true

true, to recalculate summaries on the client side; otherwise, false.

Remarks

The grid allows you to recalculate total and group summaries on the client side at runtime.

Note

This feature only works in batch edit mode.

To disable automatic recalculation, set the EnableRealTimeSummaryRecalculation property to false.

<dx:ASPxGridView ID="Grid" runat="server" ...>
    <Columns>
    ...
    </Columns>
    <SettingsEditing Mode="Batch">
        <BatchEditSettings EnableRealTimeSummaryRecalculation="false" />
    </SettingsEditing>
</dx:ASPxGridView> 

The grid with default settings does not highlight its summaries when their values are recalculated in real time. You can do one of the following to highlight recalculated summaries:

Note

The SummaryDisplayText event does not fire by default when grid-like controls are edited in batch edit mode.

Breaking Change: T887544

  • Set the HighlightSummaryItems property to true to use the predefined style settings.

    ASPxGridView/MVCxGridView: GridViewBatchEditSettings.HighlightSummaryItems

    ASPxCardView/MVCxCardView: CardViewBatchEditSettings.HighlightSummaryItems

    ASPxVerticalGrid/MVCxVerticalGrid: VerticalGridBatchEditSettings.HighlightSummaryItems

    GridViewBatchEditSettings - HighlightSummaryItems Property

    <dx:ASPxGridView ID="GridView" runat="server" ...>
        ...
        <SettingsEditing Mode="Batch">
            <BatchEditSettings HighlightSummaryItems="True" />
        </SettingsEditing>
    </dx:ASPxGridView>
    
  • Handle the BatchEditSummaryDisplayText client-side event to provide custom content and appearance on the summaries. In the following example, the grid highlights the “Total” column’s summaries with a green color when their values change or with a red color when their values exceed 1,300,000.

    GridView - BatchEditSummaryDisplayText Event

    <dx:ASPxGridView ID="Grid" runat="server" ClientInstanceName="grid" >
        // ...
        <SettingsEditing Mode="Batch" />
        <ClientSideEvents BatchEditSummaryDisplayText="onBatchEditSummaryDisplayText" />
        <TotalSummary>
            <dx:ASPxSummaryItem FieldName="Total" SummaryType="Sum" />
        </TotalSummary>
        <GroupSummary>
            <dx:ASPxSummaryItem FieldName="Total" SummaryType="Sum" />
        </GroupSummary>
    </dx:ASPxGridView>
    
    function onBatchEditSummaryDisplayText(s, e) {
        if (e.summaryFieldName === "Total") {
            var isValueChanged = e.value !== e.serverValue;
            var hasLargeValue = e.value > 1300000;
            ASPxClientUtils.ToggleClassName(e.summaryElement, "summaryItemChangedValue", isValueChanged);
            ASPxClientUtils.ToggleClassName(e.summaryElement, "summaryItemLargeValue", hasLargeValue);
        }
    }
    
    .summaryItemChangedValue {
        background-color: #d7f9c7;
    }
    .summaryItemLargeValue,
    .summaryItemLargeValue.summaryItemChangedValue {
        background-color: #ffe6e6;
    }
    

Note

The BatchEditSummaryDisplayText event has higher priority over the HighlightSummaryItems property setting.

The grid does not recalculate Min and Max summaries (SummaryType) immediately if an end-user performs the following data modifications:

  • Increases a cell value that was equal to the calculated minimum.

  • Decreases a value that was equal to the calculated maximum.

In these cases, the grid may need to query data from other pages to ensure that an summary update is necessary. You should click the ‘Update Summaries’ button to send a callback to the server and recalculate summaries.

On the image below, the ‘Max Discount’ summary has an empty value and the ‘Update summaries’ button is visible when a user changes the ‘Discount’ column value from 15% to 14%.

GridView - Update Summaries Button

Limitations

Automatic client-side summary recalculation has the following limitations:

  • The grid does not re-group data on the client if you change values in visible group columns (ShowGroupedColumns) or if you create a new row in batch edit mode. This may lead to incorrect summary results, because records may no longer belong to the same groups that they did before the update. To re-group data on the server and update summary values, click the “Save changes” button.

  • Custom summary functions are not supported.

  • Interval and custom grouping are not supported.

  • The MVC GridView cannot recalculate summary values on the client in the custom data binding mode.

Online Demo

ASPxGridView - Client Summary Calculation

Concepts

ASPxGridView:

ASPxCardView:

ASPxVerticalGrid:

See Also