Skip to content

Commit 7a0cbb9

Browse files
authored
Merge pull request #10579 from IgniteUI/skrastev/fix-simple-config-dim
Fix simple dimensions merging on same level when there are multiple siblings.
2 parents 5d2c07a + c045a74 commit 7a0cbb9

File tree

2 files changed

+19
-20
lines changed

2 files changed

+19
-20
lines changed

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

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -58,22 +58,22 @@ export class PivotRowDimensionsStrategy implements IPivotDimensionStrategy {
5858
.processHierarchy(hierarchyFields, newData[i] ?? [], pivotKeys, 0);
5959
PivotUtil.processSiblingProperties(newData[i], siblingData, pivotKeys);
6060

61-
PivotUtil.processSubGroups(row, prevRowDims.slice(0), siblingData, pivotKeys);
62-
if (siblingData.length > 1) {
63-
newData[i][row.memberName + '_' + pivotKeys.records] = siblingData;
64-
} else {
65-
newData.splice(i , 1, ...siblingData);
66-
}
61+
PivotUtil.processSubGroups(row, prevRowDims.slice(0), siblingData, pivotKeys);
62+
if (PivotUtil.getDimensionDepth(prevDim) > PivotUtil.getDimensionDepth(row) && siblingData.length > 1) {
63+
newData[i][row.memberName + '_' + pivotKeys.records] = siblingData;
64+
} else {
65+
newData.splice(i, 1, ...siblingData);
6766
i += siblingData.length - 1;
6867
}
69-
data = newData;
70-
prevDim = row;
71-
prevRowDims.push(row);
7268
}
69+
data = newData;
70+
prevDim = row;
71+
prevRowDims.push(row);
7372
}
74-
return data;
7573
}
74+
return data;
7675
}
76+
}
7777

7878
export class PivotColumnDimensionsStrategy implements IPivotDimensionStrategy {
7979
private static _instance: PivotRowDimensionsStrategy = null;
@@ -176,7 +176,7 @@ export class DimensionValuesFilteringStrategy extends FilteringStrategy {
176176
}
177177

178178
protected getFieldValue(rec: any, fieldName: string, isDate: boolean = false, isTime: boolean = false,
179-
grid?: PivotGridType): any {
179+
grid?: PivotGridType): any {
180180
const config = grid.pivotConfiguration;
181181
const allDimensions = config.rows.concat(config.columns).concat(config.filters).filter(x => x !== null);
182182
const enabledDimensions = allDimensions.filter(x => x && x.enabled);
@@ -192,13 +192,13 @@ export class DefaultPivotSortingStrategy extends DefaultSortingStrategy {
192192
return this._instance || (this._instance = new this());
193193
}
194194
public sort(data: any[],
195-
fieldName: string,
196-
dir: SortingDirection,
197-
ignoreCase: boolean,
198-
valueResolver: (obj: any, key: string, isDate?: boolean) => any,
199-
isDate?: boolean,
200-
isTime?: boolean,
201-
grid?: PivotGridType) {
195+
fieldName: string,
196+
dir: SortingDirection,
197+
ignoreCase: boolean,
198+
valueResolver: (obj: any, key: string, isDate?: boolean) => any,
199+
isDate?: boolean,
200+
isTime?: boolean,
201+
grid?: PivotGridType) {
202202
const key = fieldName;
203203
const config = grid.pivotConfiguration;
204204
const allDimensions = config.rows.concat(config.columns).concat(config.filters).filter(x => x !== null);

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -223,8 +223,7 @@ describe('Pivot pipes', () => {
223223
}]);
224224
});
225225

226-
// xit-ing because of https://github.com/IgniteUI/igniteui-angular/issues/10546
227-
xit('transforms flat data to pivot data multiple row dimensions', () => {
226+
it('transforms flat data to pivot data multiple row dimensions', () => {
228227
pivotConfig.rows = [
229228
{
230229
memberName: 'ProductCategory',

0 commit comments

Comments
 (0)