Skip to content

Commit bd57fe9

Browse files
authored
Merge pull request #5900 from IgniteUI/SKrastev/fix-5251-8.2.x
fix(igHierarchicalGrid): Fix navigating down to partially visible cell with index available in previous expanded grid.
2 parents 49d229d + a857247 commit bd57fe9

File tree

6 files changed

+25
-9
lines changed

6 files changed

+25
-9
lines changed

projects/igniteui-angular/src/lib/grids/common/grid.interface.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { FilterMode } from './enums';
22

33
export interface GridType {
4+
id: string;
45
nativeElement: HTMLElement;
56
rowEditable: boolean;
67
rootSummariesEnabled: boolean;

projects/igniteui-angular/src/lib/grids/grid-navigation.service.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -628,7 +628,7 @@ export class IgxGridNavigationService {
628628

629629
protected getNextRowByIndex(nextIndex) {
630630
return this.grid.tbody.nativeElement.querySelector(
631-
`[data-rowindex="${nextIndex}"]`);
631+
`[data-rowindex="${nextIndex}"][data-gridid="${this.grid.id}"]`);
632632
}
633633

634634
private getAllRows() {

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ export class IgxGridGroupByRowComponent {
8383
* ```
8484
*/
8585
@Input()
86+
@HostBinding('attr.data-gridID')
8687
public gridID: string;
8788

8889
/**

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

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -32,23 +32,35 @@ describe('IgxHierarchicalGrid Basic Navigation #hGrid', () => {
3232
}));
3333

3434
// simple tests
35-
it('should allow navigating down from parent row into child grid.', () => {
36-
const fCell = hierarchicalGrid.dataRowList.toArray()[0].cells.toArray()[0].nativeElement;
35+
it('should allow navigating down from parent row into child grid.', (async() => {
36+
hierarchicalGrid.expandChildren = false;
37+
hierarchicalGrid.height = '600px';
38+
hierarchicalGrid.width = '800px';
39+
fixture.componentInstance.rowIsland.height = '350px';
40+
fixture.detectChanges();
41+
await wait(100);
42+
43+
const row1 = hierarchicalGrid.dataRowList.toArray()[0] as IgxHierarchicalRowComponent;
44+
UIInteractions.clickElement(row1.expander);
45+
fixture.detectChanges();
46+
await wait(100);
47+
48+
const fCell = hierarchicalGrid.dataRowList.toArray()[1].cells.toArray()[0].nativeElement;
3749
fCell.focus();
3850
fixture.detectChanges();
51+
3952
const keyboardEvent = new KeyboardEvent('keydown', {
4053
code: 'ArrowDown',
4154
key: 'ArrowDown'
4255
});
4356
fCell.dispatchEvent(keyboardEvent);
57+
await wait(100);
4458
fixture.detectChanges();
4559

46-
const childGrid = hierarchicalGrid.hgridAPI.getChildGrids(false)[0];
47-
const childFirstCell = childGrid.dataRowList.toArray()[0].cells.toArray()[0];
48-
49-
expect(childFirstCell.selected).toBe(true);
50-
expect(childFirstCell.focused).toBe(true);
51-
});
60+
const sCell = hierarchicalGrid.dataRowList.toArray()[2].cells.toArray()[0];
61+
expect(sCell.selected).toBe(true);
62+
expect(sCell.focused).toBe(true);
63+
}));
5264

5365
it('should allow navigating up from child row into parent grid.', () => {
5466
const childGrid = hierarchicalGrid.hgridAPI.getChildGrids(false)[0];

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ export abstract class IgxRowComponent<T extends IgxGridBaseComponent & IGridData
5959
* @hidden
6060
*/
6161
@Input()
62+
@HostBinding('attr.data-gridID')
6263
public gridID: string;
6364

6465
/**

projects/igniteui-angular/src/lib/grids/summaries/summary-row.component.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ export class IgxSummaryRowComponent implements DoCheck {
3232
public summaries: Map<string, IgxSummaryResult[]>;
3333

3434
@Input()
35+
@HostBinding('attr.data-gridID')
3536
public gridID;
3637

3738
@Input()

0 commit comments

Comments
 (0)