I am using DevExtreme and want to use the summary function. If there is the same data in the same column, it is counted
let te_arr = [];
dxDataGrid({
..................
columns: [
{ dataField: "columnsTest", caption: "columnsTest"}
],
summary: {
recalculateWhileEditing: true,
totalItems: [
{
name: "SelectedRowsSummary",
showInColumn: "columnsTest",
displayFormat: "count: {0}",
summaryType: "custom"
}],
calculateCustomSummary: function (options) {
if(options.value){
let data_state = options.value.columndata
console.log('data_state ',data_state );
if (options.name == "SelectedRowsSummary") {
if (options.summaryProcess === "start") {
options.totalValue = 0;
}
if (options.summaryProcess === "calculate") {
if (data_state == 'Y') {
te_arr.push(data_state );
options.totalValue = te_arr.length;
}
}
}
}
}
},
.................
The above result is a count of 7 As a result you get the total count of the same data, but when an event like a grid button desc or asc is handled, the number is doubled. It seems like that because calculateCustomSummary is complete and after that it continues to fire when the event occurs. How should it be handled?