Skip to content

Commit e55146d

Browse files
Martin DragnevMartin Dragnev
authored andcommitted
chore(*): code refactoring
1 parent f66b681 commit e55146d

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

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

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -617,9 +617,7 @@ export class IgxHierarchicalGridNavigationService extends IgxGridNavigationServi
617617
this.focusNextChild(next, visibleColumnIndex, nextParentGrid);
618618
} else {
619619
const nextGrid = grid || nextParentGrid;
620-
this.focusNextRow(next, visibleColumnIndex > nextGrid.columnList.length
621-
? nextParentGrid.columnList.length - 1
622-
: visibleColumnIndex, nextGrid);
620+
this.focusNextRow(next, visibleColumnIndex, grid || nextParentGrid);
623621
}
624622
} else if (verticalScroll.scrollTop !==
625623
verticalScroll.scrollHeight - nextParentGrid.verticalScrollContainer.igxForContainerSize && !atLastChunk) {
@@ -678,6 +676,8 @@ export class IgxHierarchicalGridNavigationService extends IgxGridNavigationServi
678676
}
679677

680678
private focusNextRow(elem, visibleColumnIndex, grid, isSummary?) {
679+
const lastCellIndex = grid.unpinnedColumns[grid.unpinnedColumns.length - 1].visibleIndex;
680+
visibleColumnIndex = Math.min(lastCellIndex, visibleColumnIndex);
681681
const cellSelector = this.getCellSelector(visibleColumnIndex, isSummary);
682682
if (grid.navigation.isColumnFullyVisible(visibleColumnIndex) || grid.rowList.length === 0) {
683683
const cell =
@@ -704,6 +704,8 @@ export class IgxHierarchicalGridNavigationService extends IgxGridNavigationServi
704704
}
705705

706706
private focusPrevRow(elem, visibleColumnIndex, grid, inChild?, isSummary?) {
707+
const lastCellIndex = grid.unpinnedColumns[grid.unpinnedColumns.length - 1].visibleIndex;
708+
visibleColumnIndex = Math.min(lastCellIndex, visibleColumnIndex);
707709
if (grid.navigation.isColumnFullyVisible(visibleColumnIndex)) {
708710
const cellSelector = this.getCellSelector(visibleColumnIndex, isSummary);
709711
const cells = elem.querySelectorAll(`${cellSelector}[data-visibleIndex="${visibleColumnIndex}"]`);

0 commit comments

Comments
 (0)