Skip to content

Commit 244e792

Browse files
authored
Merge pull request #10657 from IgniteUI/mkirova/fix-10644
Collect original records so that custom aggregations can be applied b…
2 parents 840d611 + 68ec150 commit 244e792

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
@@ -221,8 +221,8 @@ export class PivotUtil {
221221
const children = hierarchy[pivotKeys.children];
222222
if (children && children.size > 0) {
223223
this.applyAggregations(children, values, pivotKeys);
224-
const childrenAggregations = this.collectAggregations(children, pivotKeys);
225-
hierarchy[pivotKeys.aggregations] = this.aggregate(childrenAggregations, values);
224+
const childRecords = this.collectRecords(children, pivotKeys);
225+
hierarchy[pivotKeys.aggregations] = this.aggregate(childRecords, values);
226226
} else if (hierarchy[pivotKeys.records]) {
227227
hierarchy[pivotKeys.aggregations] = this.aggregate(hierarchy[pivotKeys.records], values);
228228
}
@@ -403,10 +403,9 @@ export class PivotUtil {
403403
return flatData;
404404
}
405405

406-
private static collectAggregations(children, pivotKeys) {
407-
const result = [];
408-
children.forEach(value => result.push(value[pivotKeys.aggregations]));
409-
406+
private static collectRecords(children, pivotKeys: IPivotKeys) {
407+
let result = [];
408+
children.forEach(value => result = result.concat(value[pivotKeys.records]));
410409
return result;
411410
}
412411

0 commit comments

Comments
 (0)