Skip to content

Commit 8c1f4d1

Browse files
authored
Merge branch '7.3.x' into mkirova/fix-5751
2 parents 8455484 + 49aaa10 commit 8c1f4d1

File tree

2 files changed

+30
-0
lines changed

2 files changed

+30
-0
lines changed

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,7 @@ export abstract class IgxHierarchicalGridBaseComponent extends IgxGridBaseCompon
143143
const result = flatten(columns);
144144
this.columnList.reset(result);
145145
this.columnList.notifyOnChanges();
146+
this.initPinning();
146147
}
147148

148149
protected _createColumn(col) {

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

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -941,6 +941,35 @@ describe('IgxHierarchicalGrid Integration', () => {
941941
expect(childGrid.columnList.toArray()[0].pinned).toBeTruthy();
942942
expect(headers[0].classList.contains('igx-grid__th--pinned')).toBeTruthy();
943943
}));
944+
945+
it('should be applied correctly for child grid with multi-column header.', (() => {
946+
const ri = fixture.componentInstance.rowIsland;
947+
const col = ri.columnList.find(x => x.header === 'Information');
948+
col.pinned = true;
949+
fixture.detectChanges();
950+
951+
const row = hierarchicalGrid.getRowByIndex(0) as IgxHierarchicalRowComponent;
952+
UIInteractions.clickElement(row.expander);
953+
fixture.detectChanges();
954+
955+
const childGrids = fixture.debugElement.queryAll(By.css('igx-child-grid-row'));
956+
const childGrid = childGrids[0].query(By.css('igx-hierarchical-grid')).componentInstance;
957+
// check unpinned/pinned columns
958+
expect(childGrid.pinnedColumns.length).toBe(3);
959+
expect(childGrid.unpinnedColumns.length).toBe(1);
960+
// check cells
961+
const cells = childGrid.getRowByIndex(0).cells;
962+
expect(cells.length).toBe(3);
963+
let cell = childGrid.getCellByColumn(0, 'ChildLevels');
964+
expect(cell.visibleColumnIndex).toEqual(0);
965+
expect(cell.nativeElement.classList.contains('igx-grid__td--pinned')).toBe(true);
966+
cell = childGrid.getCellByColumn(0, 'ProductName');
967+
expect(cell.visibleColumnIndex).toEqual(1);
968+
expect(cell.nativeElement.classList.contains('igx-grid__td--pinned')).toBe(true);
969+
cell = childGrid.getCellByColumn(0, 'ID');
970+
expect(cell.visibleColumnIndex).toEqual(2);
971+
expect(cell.nativeElement.classList.contains('igx-grid__td--pinned')).toBe(false);
972+
}));
944973
});
945974
});
946975

0 commit comments

Comments
 (0)