// create a GroupRow to show aggregates
const row = new GroupRow();
// 총계 footer [aggregate로 해결되는부분]
grid.columnFooters.rows.push(row);
// 총계 footer [aggregate가 없는 부분커스터마이징]
grid?.formatItem.addHandler((grid: any, arg: any) => {
//grid.beginUpdate();
const l1Col = -1;
let mfCol = -1;
let aouCol = -1;
let aeuCol = -1;
let potCol = -1;
if (grid.columns[arg.col].binding === 'l1ItemNo') {
grid.columnFooters.setCellData(0, arg.col, '총계' , true, false);
} else if (grid.columns[arg.col].binding === 'checklistMandatoryFlag') {
mfCol = arg.col;
}
let mfCnt = 0;
let aouCnt = 0;
let aeuCnt = 0;
let potSum = 0;
grid.rows.forEach((row: any, idx: number) => {
if (row.dataItem.checklistMandatoryFlag === true) {
mfCnt += 1;
}
if (row.dataItem.auditorUseFlag === true) {
aouCnt += 1;
}
if (row.dataItem.auditeeUseFlag === true) {
aeuCnt += 1;
}
if (row.dataItem.auditorUseFlag === true) {
if (!CommonUtils.isEmptyObject(row.dataItem.checklistItemPoint)) {
potSum += Number(row.dataItem.checklistItemPoint);
}
}
});
if (l1Col != -1) grid.columnFooters.setCellData(0, l1Col, '총계' , true, false);
if (mfCol != -1) grid.columnFooters.setCellData(0, mfCol, mfCnt, true, false);
if (aouCol != -1) grid.columnFooters.setCellData(0, aouCol, aouCnt, true, false);
if (aeuCol != -1) grid.columnFooters.setCellData(0, aeuCol, aeuCnt, true, false);
if (potCol != -1) grid.columnFooters.setCellData(0, potCol, potSum, true, false);
});