fix: footer(합계) 작업 중

This commit is contained in:
2025-12-29 11:49:07 +09:00
parent ba4062f826
commit 2009c54a00
38 changed files with 1367 additions and 1083 deletions
@@ -0,0 +1,22 @@
import type { GridView, DataColumn } from "@/components/type/DataGrid.type";
export const getFooterSummary = (grid: GridView, column: DataColumn) => {
// 데이터 소스에서 직접 합계 계산
const dataSource = grid.getDataSource();
const rowCount = dataSource.getRowCount();
let sum = 0;
for (let i = 0; i < rowCount; i++) {
const cellValue = dataSource.getValue(i, column.fieldName);
// 문자열인 경우 숫자로 변환
const numericValue = typeof cellValue === 'string'
? Number(String(cellValue).replace(/,/g, ''))
: Number(cellValue);
if (!isNaN(numericValue) && numericValue !== null && numericValue !== undefined) {
sum += numericValue;
}
}
return sum;
};