Skip to content

Commit 59067d1

Browse files
MKirovaMKirova
authored andcommitted
Collect original records so that custom aggregations can be applied based on multiple fields in the data.
1 parent 0b9bd60 commit 59067d1

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

projects/igniteui-angular/src/lib/grids/pivot-grid/pivot-util.ts

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -220,8 +220,8 @@ export class PivotUtil {
220220
const children = hierarchy[pivotKeys.children];
221221
if (children && children.size > 0) {
222222
this.applyAggregations(children, values, pivotKeys);
223-
const childrenAggregations = this.collectAggregations(children, pivotKeys);
224-
hierarchy[pivotKeys.aggregations] = this.aggregate(childrenAggregations, values);
223+
const childRecords = this.collectRecords(children, pivotKeys);
224+
hierarchy[pivotKeys.aggregations] = this.aggregate(childRecords, values);
225225
} else if (hierarchy[pivotKeys.records]) {
226226
hierarchy[pivotKeys.aggregations] = this.aggregate(hierarchy[pivotKeys.records], values);
227227
}
@@ -400,10 +400,9 @@ export class PivotUtil {
400400
return flatData;
401401
}
402402

403-
private static collectAggregations(children, pivotKeys) {
404-
const result = [];
405-
children.forEach(value => result.push(value[pivotKeys.aggregations]));
406-
403+
private static collectRecords(children, pivotKeys: IPivotKeys) {
404+
let result = [];
405+
children.forEach(value => result = result.concat(value[pivotKeys.records]));
407406
return result;
408407
}
409408

0 commit comments

Comments
 (0)