Skip to content

Commit bdc1ab1

Browse files
committed
fix(grid): dynamic column-group children setup
1 parent 865394a commit bdc1ab1

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

projects/igniteui-angular/src/lib/grids/columns/column-group.component.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import {
1010
Output,
1111
EventEmitter
1212
} from '@angular/core';
13+
import { takeUntil } from 'rxjs/operators';
1314

1415
import { IgxColumnComponent } from './column.component';
1516
import { flatten } from '../../core/utils';
@@ -298,6 +299,15 @@ export class IgxColumnGroupComponent extends IgxColumnComponent implements After
298299
if (this.collapsible) {
299300
this.setExpandCollapseState();
300301
}
302+
303+
this.children.changes
304+
.pipe(takeUntil(this.destroy$))
305+
.subscribe((change: QueryList<IgxColumnComponent>) => {
306+
change.forEach(x => x.parent = this);
307+
if (this.collapsible) {
308+
this.setExpandCollapseState();
309+
}
310+
});
301311
}
302312

303313
/**

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ describe('IgxGrid - multi-column headers #grid', () => {
135135

136136
}));
137137

138-
it('Should render dynamic column group header correctly (#12165).', fakeAsync(() => {
138+
it('Should render dynamic column group header correctly (#12165).', () => {
139139
fixture = TestBed.createComponent(BlueWhaleGridComponent) as ComponentFixture<BlueWhaleGridComponent>;
140140
(fixture as ComponentFixture<BlueWhaleGridComponent>).componentInstance.firstGroupRepeats = 1;
141141
(fixture as ComponentFixture<BlueWhaleGridComponent>).componentInstance.secondGroupRepeats = 1;
@@ -172,7 +172,7 @@ describe('IgxGrid - multi-column headers #grid', () => {
172172
firstSixHeaders = allHeaders.slice(0, 6).map(x => x.column.field);
173173
expect(allHeaders.length).toEqual(15);
174174
expect(firstSixHeaders).toEqual(['ID', 'Missing', 'ID', 'ID', 'ID', 'CompanyName']);
175-
}));
175+
});
176176

177177
it('Should not render empty column group.', () => {
178178
fixture = TestBed.createComponent(ColumnGroupTestComponent);

0 commit comments

Comments
 (0)