Skip to content

Commit fb897df

Browse files
MKirovaMKirova
authored andcommitted
Ensure that records, reviously removed in the column pipe, are again removed from the final flat data.
1 parent 9e6081c commit fb897df

File tree

3 files changed

+15
-3
lines changed

3 files changed

+15
-3
lines changed

projects/igniteui-angular/src/lib/data-operations/pivot-strategy.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,14 @@ export class PivotColumnDimensionsStrategy implements IPivotDimensionStrategy {
110110
if (k.indexOf(pivotKeys.records) !== -1) {
111111
if (hierarchy[k] && hierarchy[k].length > 0 && k !== pivotKeys.records) {
112112
const unprocessed = hierarchy[k].filter(r => !r.processed);
113-
this.processHierarchy(unprocessed, columns, values, pivotKeys);
113+
const res = this.processHierarchy(unprocessed, columns, values, pivotKeys);
114+
if (res.length !== unprocessed.length) {
115+
// some records should be removed from the final flat collection
116+
// since this is no longer the final pipe just mark it for removal.
117+
unprocessed.forEach(element => {
118+
element.remove = true;
119+
});
120+
}
114121
}
115122
//delete hierarchy[k];
116123
}

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,9 @@ export class IgxPivotRowExpansionPipe implements PipeTransform {
6868
PivotUtil.flattenHierarchy(data, config, row, expansionStates, pivotKeys, totalLlv, prevDims, 0);
6969
prevDims.push(row);
7070
}
71-
this.cleanState(data, pivotKeys);
72-
return data;
71+
const finalData = data.filter(x => !x.remove);
72+
this.cleanState(finalData, pivotKeys);
73+
return finalData;
7374
}
7475

7576
private cleanState(data, pivotKeys) {

src/app/pivot-grid/pivot-grid.sample.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,10 @@ export class PivotGridSampleComponent {
7171
memberName: 'ProductCategory',
7272
enabled: true
7373
}
74+
},
75+
{
76+
memberName: 'SellerName',
77+
enabled: true
7478
}
7579
],
7680
values: [

0 commit comments

Comments
 (0)