Skip to content

Commit 3aba7a1

Browse files
authored
fix(igxHierarchicalGrid): Fix column grid owner before copying column for child. (#15204)
1 parent 06959f3 commit 3aba7a1

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -207,6 +207,7 @@ export abstract class IgxHierarchicalGridBaseDirective extends IgxGridBaseDirect
207207
const columns = [];
208208
const topLevelCols = cols.filter(c => c.level === 0);
209209
topLevelCols.forEach((col) => {
210+
col.grid = this;
210211
const ref = this._createColumn(col);
211212
ref.changeDetectorRef.detectChanges();
212213
columns.push(ref.instance);

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

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1069,6 +1069,23 @@ describe('Basic IgxHierarchicalGrid #hGrid', () => {
10691069
expect(hierarchicalGrid.childLayoutList.first.columns.length).toEqual(0, 'Columns length should be 0 after toggle');
10701070
expect(hierarchicalGrid.childLayoutList.first.columnList.length).toEqual(0, 'ColumnList length should be 0 after toggle');
10711071
}));
1072+
1073+
it('should resolve child grid cols default editable prop correctly based on row island\'s rowEditable.', () => {
1074+
hierarchicalGrid.rowEditable = false;
1075+
hierarchicalGrid.childLayoutList.first.rowEditable = true;
1076+
fixture.detectChanges();
1077+
// expand row
1078+
const row = hierarchicalGrid.gridAPI.get_row_by_index(0) as IgxHierarchicalRowComponent;
1079+
UIInteractions.simulateClickAndSelectEvent(row.expander);
1080+
fixture.detectChanges();
1081+
1082+
//check child grid column are editable
1083+
const childGrids = fixture.debugElement.queryAll(By.css('igx-child-grid-row'));
1084+
const childGrid1 = childGrids[0].query(By.css('igx-hierarchical-grid')).componentInstance;
1085+
1086+
expect(childGrid1.columns[0].editable).toBeTrue();
1087+
expect(childGrid1.columns[1].editable).toBeTrue();
1088+
});
10721089
});
10731090

10741091
describe('IgxHierarchicalGrid Children Sizing #hGrid', () => {

0 commit comments

Comments
 (0)