Skip to content

Commit eb7d533

Browse files
MKirovaMKirova
authored andcommitted
chore(*): Fix for last visible index when moving from grid with more columns to a grid with less when there are multi-column headers involved.
1 parent 9f25544 commit eb7d533

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -214,8 +214,8 @@ export class IgxHierarchicalGridNavigationService extends IgxGridNavigationServi
214214

215215
const childGridNav = childGrid.navigation;
216216
this.clearActivation();
217-
const visibleColsLength = childGrid.visibleColumns.length - 1;
218-
const columnIndex = visibleColIndex <= visibleColsLength ? visibleColIndex : visibleColsLength;
217+
const lastVisibleIndex = childGridNav.lastColumnIndex;
218+
const columnIndex = visibleColIndex <= lastVisibleIndex ? visibleColIndex : lastVisibleIndex;
219219
childGridNav.activeNode = { row: targetIndex, column: columnIndex};
220220
childGrid.tbody.nativeElement.focus({preventScroll: true});
221221
this._pendingNavigation = false;
@@ -236,8 +236,8 @@ export class IgxHierarchicalGridNavigationService extends IgxGridNavigationServi
236236
}
237237
this.clearActivation();
238238
const targetRowIndex = isNext ? indexInParent + 1 : indexInParent - 1;
239-
const visibleColsLength = this.grid.parent.visibleColumns.length - 1;
240-
const nextColumnIndex = columnIndex <= visibleColsLength ? columnIndex : visibleColsLength;
239+
const lastVisibleIndex = this.grid.parent.navigation.lastColumnIndex;
240+
const nextColumnIndex = columnIndex <= lastVisibleIndex ? columnIndex : lastVisibleIndex;
241241
this._pendingNavigation = true;
242242
const cbFunc = (args) => {
243243
args.target.grid.tbody.nativeElement.focus();

0 commit comments

Comments
 (0)