Skip to content

Commit ca2a867

Browse files
authored
fix(rowIsland): update columns property on column change (#14192)
1 parent 58a4ae5 commit ca2a867

File tree

2 files changed

+18
-3
lines changed

2 files changed

+18
-3
lines changed

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

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1015,6 +1015,19 @@ describe('Basic IgxHierarchicalGrid #hGrid', () => {
10151015

10161016
expect(fixture.componentInstance.childGridRef.elementRef.nativeElement).toEqual(child1Grid.nativeElement);
10171017
});
1018+
1019+
it('should update columns property of row islands on columns change.', fakeAsync(() => {
1020+
1021+
expect(hierarchicalGrid.childLayoutList.first.columns.length).toEqual(2, 'Initial columns length should be 2');
1022+
expect(hierarchicalGrid.childLayoutList.first.columnList.length).toEqual(2, 'Initial columnList length should be 2');
1023+
1024+
fixture.componentInstance.toggleColumns = false;
1025+
fixture.detectChanges();
1026+
tick();
1027+
1028+
expect(hierarchicalGrid.childLayoutList.first.columns.length).toEqual(0, 'Columns length should be 0 after toggle');
1029+
expect(hierarchicalGrid.childLayoutList.first.columnList.length).toEqual(0, 'ColumnList length should be 0 after toggle');
1030+
}));
10181031
});
10191032

10201033
describe('IgxHierarchicalGrid Children Sizing #hGrid', () => {
@@ -1867,8 +1880,8 @@ export class IgxHierarchicalGridTestBaseComponent {
18671880
<igx-column field="ID"></igx-column>
18681881
<igx-column field="ProductName"></igx-column>
18691882
<igx-row-island [key]="'childData'" [autoGenerate]="false" [height]="height" #rowIsland1>
1870-
<igx-column field="ID"></igx-column>
1871-
<igx-column field="ProductName"></igx-column>
1883+
<igx-column field="ID" *ngIf="toggleColumns"></igx-column>
1884+
<igx-column field="ProductName" *ngIf="toggleColumns"></igx-column>
18721885
</igx-row-island>
18731886
<igx-row-island [key]="'childData2'" [autoGenerate]="false" [height]="height" #rowIsland2>
18741887
<igx-column field="Col1"></igx-column>
@@ -1877,12 +1890,13 @@ export class IgxHierarchicalGridTestBaseComponent {
18771890
</igx-row-island>
18781891
</igx-hierarchical-grid>`,
18791892
standalone: true,
1880-
imports: [IgxHierarchicalGridComponent, IgxColumnComponent, IgxRowIslandComponent]
1893+
imports: [IgxHierarchicalGridComponent, IgxColumnComponent, IgxRowIslandComponent, NgIf]
18811894
})
18821895
export class IgxHierarchicalGridMultiLayoutComponent extends IgxHierarchicalGridTestBaseComponent {
18831896
@ViewChild('rowIsland1', { read: IgxRowIslandComponent, static: true }) public rowIsland1: IgxRowIslandComponent;
18841897
@ViewChild('rowIsland2', { read: IgxRowIslandComponent, static: true }) public override rowIsland2: IgxRowIslandComponent;
18851898
public height = '100px';
1899+
public toggleColumns = true;
18861900
}
18871901

18881902
@Component({

projects/igniteui-angular/src/lib/grids/hierarchical-grid/row-island.component.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -400,6 +400,7 @@ export class IgxRowIslandComponent extends IgxHierarchicalGridBaseDirective
400400
return false;
401401
});
402402
this._childColumns = topCols;
403+
this.updateColumns(this._childColumns);
403404
this.rowIslandAPI.getChildGrids().forEach((grid: GridType) => {
404405
grid.createColumnsList(this._childColumns);
405406
if (!document.body.contains(grid.nativeElement)) {

0 commit comments

Comments
 (0)