Skip to content

Commit 4fcacb1

Browse files
authored
fix(igxHierarchicalGrid): Fix column grid owner before copying column for child. (#15206)
1 parent 620832f commit 4fcacb1

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
@@ -1038,6 +1038,23 @@ describe('Basic IgxHierarchicalGrid #hGrid', () => {
10381038
expect(hierarchicalGrid.childLayoutList.first.columns.length).toEqual(0, 'Columns length should be 0 after toggle');
10391039
expect(hierarchicalGrid.childLayoutList.first.columnList.length).toEqual(0, 'ColumnList length should be 0 after toggle');
10401040
}));
1041+
1042+
it('should resolve child grid cols default editable prop correctly based on row island\'s rowEditable.', () => {
1043+
hierarchicalGrid.rowEditable = false;
1044+
hierarchicalGrid.childLayoutList.first.rowEditable = true;
1045+
fixture.detectChanges();
1046+
// expand row
1047+
const row = hierarchicalGrid.gridAPI.get_row_by_index(0) as IgxHierarchicalRowComponent;
1048+
UIInteractions.simulateClickAndSelectEvent(row.expander);
1049+
fixture.detectChanges();
1050+
1051+
//check child grid column are editable
1052+
const childGrids = fixture.debugElement.queryAll(By.css('igx-child-grid-row'));
1053+
const childGrid1 = childGrids[0].query(By.css('igx-hierarchical-grid')).componentInstance;
1054+
1055+
expect(childGrid1.columns[0].editable).toBeTrue();
1056+
expect(childGrid1.columns[1].editable).toBeTrue();
1057+
});
10411058
});
10421059

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

0 commit comments

Comments
 (0)