Skip to content

Commit fd28565

Browse files
authored
Merge pull request #10625 from IgniteUI/mkirova/fix-10610
Remove unnecessary leaf records from pivot data.
2 parents 337614b + 5a9fc7a commit fd28565

File tree

4 files changed

+11
-10
lines changed

4 files changed

+11
-10
lines changed

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

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -121,11 +121,6 @@ export class PivotColumnDimensionsStrategy implements IPivotDimensionStrategy {
121121
delete hierarchy[k];
122122
}
123123
});
124-
delete hierarchy.processed;
125-
if (this.isLeaf(hierarchy, pivotKeys)) {
126-
delete hierarchy[pivotKeys.records]; /* remove the helper records of the actual records so that
127-
expand indicators can be rendered properly */
128-
}
129124
for (const property in flatCols) {
130125
if (flatCols.hasOwnProperty(property)) {
131126
hierarchy[property] = flatCols[property];

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -813,9 +813,9 @@ describe('Pivot pipes', () => {
813813
];
814814

815815
const rowPipeResult = rowPipe.transform(data, pivotConfig, expansionStates);
816-
const colPipeRes = columnPipe.transform(rowPipeResult, pivotConfig, expansionStates);
817-
const rowStatePipeResult = rowStatePipe.transform(colPipeRes, pivotConfig, expansionStates, true);
818-
expect(rowStatePipeResult.length).toEqual(39);
816+
const columnPipeResult = columnPipe.transform(rowPipeResult, pivotConfig, new Map<any, boolean>());
817+
const rowStatePipeResult = rowStatePipe.transform(columnPipeResult, pivotConfig, expansionStates, true);
818+
expect(rowStatePipeResult.length).toEqual(31);
819819
expect(rowStatePipeResult[0]['AllPeriods']).toEqual('All Periods');
820820
expect(rowStatePipeResult[0]['AllProducts']).toEqual('All');
821821
expect(rowStatePipeResult[0]['ProductCategory']).not.toBeDefined();

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

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,13 +69,15 @@ export class IgxPivotRowExpansionPipe implements PipeTransform {
6969
PivotUtil.flattenHierarchy(data, config, row, expansionStates, defaultExpand, pivotKeys, totalLlv, prevDims, 0);
7070
prevDims.push(row);
7171
}
72-
this.cleanState(data, pivotKeys);
73-
return data;
72+
const finalData = config.columnStrategy ? data : data.filter(x => x[pivotKeys.records]);
73+
this.cleanState(finalData, pivotKeys);
74+
return finalData;
7475
}
7576

7677
private cleanState(data, pivotKeys) {
7778
data.forEach(rec => {
7879
const keys = Object.keys(rec);
80+
delete rec.processed;
7981
//remove all record keys from final data since we don't need them anymore.
8082
keys.forEach(k => {
8183
if (k.indexOf(pivotKeys.records) !== -1) {

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,10 @@ export class PivotGridSampleComponent {
7575
memberName: 'ProductCategory',
7676
enabled: true
7777
}
78+
},
79+
{
80+
memberName: 'SellerName',
81+
enabled: true
7882
}
7983
],
8084
values: [

0 commit comments

Comments
 (0)