Skip to content

Commit f88056f

Browse files
committed
fix(igHierarchicalGrid): Fix navigating down to partially visible cell with index available in previous expanded grid. #5251
1 parent 7d69b85 commit f88056f

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
@@ -33,23 +33,35 @@ describe('IgxHierarchicalGrid Basic Navigation #hGrid', () => {
3333
}));
3434

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

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

5466
it('should allow navigating up from child row into parent grid.', () => {
5567
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)