ASPxClientGridBase.BatchEditSummaryDisplayText Event
Fires when a user changes the summary item value.
Declaration
BatchEditSummaryDisplayText: ASPxClientEvent<ASPxClientGridBatchEditSummaryDisplayTextEventHandler<ASPxClientGridBase>>
Event Data
The BatchEditSummaryDisplayText event's data class is ASPxClientGridBatchEditSummaryDisplayTextEventArgs. The following properties provide information specific to this event:
Property | Description |
---|---|
displayText | Gets or sets the summary item’s display text. |
groupRowVisibleIndex | Specifies the group row’s visible index. |
isGroupSummary | Specifies whether the processed summary is a group summary. |
isTotalSummary | Specifies whether the processed summary is a total summary. |
serverValue | Gets the summary item’s server value. |
summaryElement | Gets the element that contains the summary item. |
summaryFieldName | Gets the summary item’s field name. |
summaryItemIndex | Gets the summary item index. |
summaryType | Gets the summary type. |
value | Specifies the summary item’s value. |
Remarks
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:
Set the HighlightSummaryItems property to
true
to use the predefined style settings.<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.<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.
Online Demo
ASPxGridView - Client Summary Calculation