Skip to content

Commit 382dd79

Browse files
authored
fix(igxPivot): Re-trigger pipes for rows when columns change. (#14769)
1 parent b0a9482 commit 382dd79

File tree

2 files changed

+22
-0
lines changed

2 files changed

+22
-0
lines changed

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2161,6 +2161,7 @@ export class IgxPivotGridComponent extends IgxGridBaseDirective implements OnIni
21612161
});
21622162

21632163
this.updateColumns(columns);
2164+
this.pipeTrigger++;
21642165
this.reflow();
21652166
}
21662167

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

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -738,6 +738,27 @@ describe('IgxPivotGrid #pivotGrid', () => {
738738
expect(displayedRow).toContain('RowMember');
739739
});
740740

741+
it('should render correctly when going from all dimensions and values disabled to single column dimension enabled.', () => {
742+
const pivotGrid = fixture.componentInstance.pivotGrid as IgxPivotGridComponent;
743+
// disable all
744+
pivotGrid.pivotConfiguration.rows.forEach(x => pivotGrid.toggleDimension(x));
745+
pivotGrid.pivotConfiguration.columns.forEach(x => pivotGrid.toggleDimension(x));
746+
pivotGrid.pivotConfiguration.filters.forEach(x => pivotGrid.toggleDimension(x));
747+
pivotGrid.pivotConfiguration.values.forEach(x => pivotGrid.toggleValue(x));
748+
fixture.detectChanges();
749+
750+
// no rows, just empty message
751+
expect(pivotGrid.rowList.length).toBe(0);
752+
expect(pivotGrid.tbody.nativeElement.textContent).toBe('Pivot grid has no dimensions and values.');
753+
754+
pivotGrid.toggleDimension(pivotGrid.pivotConfiguration.columns[0]);
755+
fixture.detectChanges();
756+
757+
// 1 row, 3 columns
758+
expect(pivotGrid.rowList.length).toBe(1);
759+
expect(pivotGrid.columns.length).toBe(3);
760+
});
761+
741762

742763
describe('IgxPivotGrid Features #pivotGrid', () => {
743764
it('should show excel style filtering via dimension chip.', async () => {

0 commit comments

Comments
 (0)