Open cassmtnr opened 6 years ago
Hello again @cassianomon, the origin of the problem are empty (or null
) column values passed to the default summary function:
// summary-row.component.ts:11
function defaultSumFunc(cells: any[]): any {
return cells
.filter(cell => !!cell)
.reduce((res, cell) => res + cell);
}
The error is caused by this function which tries to reduce an empty array - at least one of datatable column is empty. I'll try to fix the issue in this week. Thank you for discovering that.
I'm submitting a ... (check one with "x")
Current behavior
Gives error:
Expected behavior SummaryRow should ignore fields that doesn't have a summaryFunc (related to https://github.com/swimlane/ngx-datatable/issues/1411)
Please tell us about your environment: OS: Windows 10 IDE: Visual Studio Code package manager: Yarn and NPM
Table version: 11.3.0 and 12.0.0
Angular version: 6.0.0 and 4.1.0
Browser: Chrome
Language: [all | TypeScript X.X | ES6/7 | ES5] TypeScript 2.4.2 and 2.7.2