Skip to content

Commit e495a0a

Browse files
authored
Merge branch '10.1.x' into iganchev/select-focus-required
2 parents f93ec93 + 7aff8c8 commit e495a0a

File tree

2 files changed

+24
-1
lines changed

2 files changed

+24
-1
lines changed

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

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -688,6 +688,28 @@ describe('IgxHierarchicalGrid selection #hGrid', () => {
688688
expect(hierarchicalGrid.getRowByKey('2').selected).toBeTrue();
689689
expect(hierarchicalGrid.getRowByKey('0').selected).toBeFalse();
690690
});
691+
692+
it('Should not clear root selection state when changing selection mode of child grid', () => {
693+
rowIsland1.rowSelection = GridSelectionMode.multiple;
694+
fix.componentInstance.selectedRows = ['0', '1'];
695+
fix.detectChanges();
696+
expect(hierarchicalGrid.getRowByKey('0').selected).toBeTrue();
697+
698+
const thirdRow = hierarchicalGrid.getRowByIndex(2) as IgxHierarchicalRowComponent;
699+
thirdRow.toggle();
700+
fix.detectChanges();
701+
702+
const childGrid = rowIsland1.rowIslandAPI.getChildGrids()[0];
703+
childGrid.selectedRows = ['20', '21'];
704+
fix.detectChanges();
705+
expect(hierarchicalGrid.selectedRows.length).toEqual(2);
706+
expect(childGrid.selectedRows.length).toEqual(2);
707+
708+
rowIsland1.rowSelection = GridSelectionMode.single;
709+
fix.detectChanges();
710+
expect(hierarchicalGrid.selectedRows.length).toEqual(2);
711+
expect(childGrid.selectedRows.length).toEqual(0);
712+
});
691713
});
692714

693715
describe('Row Selection CRUD', () => {

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,8 @@ export interface IGridCreatedEventArgs extends IBaseEventArgs {
5151
changeDetection: ChangeDetectionStrategy.OnPush,
5252
selector: 'igx-row-island',
5353
template: ``,
54-
providers: [IgxRowIslandAPIService]
54+
providers: [IgxRowIslandAPIService,
55+
IgxGridSelectionService]
5556
})
5657
export class IgxRowIslandComponent extends IgxHierarchicalGridBaseDirective
5758
implements AfterContentInit, AfterViewInit, OnChanges, OnInit, OnDestroy, DoCheck {

0 commit comments

Comments
 (0)