From c5231ab94ea0cf2e6dd6eae0ebc7635a78056d2e Mon Sep 17 00:00:00 2001 From: MKirova Date: Mon, 6 Jan 2025 18:33:18 +0200 Subject: [PATCH] fix(igxHierarchicalGrid): Fix column grid owner before copying column for child. --- .../hierarchical-grid-base.directive.ts | 1 + .../hierarchical-grid/hierarchical-grid.spec.ts | 17 +++++++++++++++++ 2 files changed, 18 insertions(+) diff --git a/projects/igniteui-angular/src/lib/grids/hierarchical-grid/hierarchical-grid-base.directive.ts b/projects/igniteui-angular/src/lib/grids/hierarchical-grid/hierarchical-grid-base.directive.ts index 849b0b57125..642a474c53b 100644 --- a/projects/igniteui-angular/src/lib/grids/hierarchical-grid/hierarchical-grid-base.directive.ts +++ b/projects/igniteui-angular/src/lib/grids/hierarchical-grid/hierarchical-grid-base.directive.ts @@ -207,6 +207,7 @@ export abstract class IgxHierarchicalGridBaseDirective extends IgxGridBaseDirect const columns = []; const topLevelCols = cols.filter(c => c.level === 0); topLevelCols.forEach((col) => { + col.grid = this; const ref = this._createColumn(col); ref.changeDetectorRef.detectChanges(); columns.push(ref.instance); diff --git a/projects/igniteui-angular/src/lib/grids/hierarchical-grid/hierarchical-grid.spec.ts b/projects/igniteui-angular/src/lib/grids/hierarchical-grid/hierarchical-grid.spec.ts index 1f8a5f07547..2acee4aa176 100644 --- a/projects/igniteui-angular/src/lib/grids/hierarchical-grid/hierarchical-grid.spec.ts +++ b/projects/igniteui-angular/src/lib/grids/hierarchical-grid/hierarchical-grid.spec.ts @@ -1038,6 +1038,23 @@ describe('Basic IgxHierarchicalGrid #hGrid', () => { expect(hierarchicalGrid.childLayoutList.first.columns.length).toEqual(0, 'Columns length should be 0 after toggle'); expect(hierarchicalGrid.childLayoutList.first.columnList.length).toEqual(0, 'ColumnList length should be 0 after toggle'); })); + + it('should resolve child grid cols default editable prop correctly based on row island\'s rowEditable.', () => { + hierarchicalGrid.rowEditable = false; + hierarchicalGrid.childLayoutList.first.rowEditable = true; + fixture.detectChanges(); + // expand row + const row = hierarchicalGrid.gridAPI.get_row_by_index(0) as IgxHierarchicalRowComponent; + UIInteractions.simulateClickAndSelectEvent(row.expander); + fixture.detectChanges(); + + //check child grid column are editable + const childGrids = fixture.debugElement.queryAll(By.css('igx-child-grid-row')); + const childGrid1 = childGrids[0].query(By.css('igx-hierarchical-grid')).componentInstance; + + expect(childGrid1.columns[0].editable).toBeTrue(); + expect(childGrid1.columns[1].editable).toBeTrue(); + }); }); describe('IgxHierarchicalGrid Children Sizing #hGrid', () => {