Skip to content

Commit a197cdd

Browse files
authored
Merge pull request #6464 from IgniteUI/mkirova/fix-5472
fix(igxHierarchicalGrid): Make sure correct column index is used when…
2 parents adbcf72 + 8974b8c commit a197cdd

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

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

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -694,11 +694,17 @@ export class IgxHierarchicalGridNavigationService extends IgxGridNavigationServi
694694
cell.focus({ preventScroll: true });
695695
}
696696
} else {
697-
const cellElem = elem.querySelector(`${cellSelector}`);
698-
const rowIndex = parseInt(cellElem.getAttribute('data-rowindex'), 10);
699-
grid.navigation.performHorizontalScrollToCell(rowIndex, visibleColumnIndex);
697+
this.horizontalScrollGridToIndex(grid, visibleColumnIndex, () => {
698+
this.focusNextRow(elem, visibleColumnIndex, grid, isSummary);
699+
});
700700
}
701701
}
702+
public getColumnUnpinnedIndex(visibleColumnIndex: number, grid?: IgxHierarchicalGridComponent) {
703+
const currGrid = grid || this.grid;
704+
const column = currGrid.unpinnedColumns.find((col) => !col.columnGroup && col.visibleIndex === visibleColumnIndex);
705+
return currGrid.pinnedColumns.length ? currGrid.unpinnedColumns.filter((c) => !c.columnGroup).indexOf(column) :
706+
visibleColumnIndex;
707+
}
702708

703709
private focusPrevRow(elem, visibleColumnIndex, grid, inChild?, isSummary?) {
704710
if (grid.navigation.isColumnFullyVisible(visibleColumnIndex)) {
@@ -735,7 +741,7 @@ export class IgxHierarchicalGridNavigationService extends IgxGridNavigationServi
735741
}
736742

737743
private horizontalScrollGridToIndex(grid, visibleColumnIndex, callBackFunc) {
738-
const unpinnedIndex = this.getColumnUnpinnedIndex(visibleColumnIndex);
744+
const unpinnedIndex = this.getColumnUnpinnedIndex(visibleColumnIndex, grid);
739745
grid.parentVirtDir.onChunkLoad
740746
.pipe(first())
741747
.subscribe(callBackFunc);

0 commit comments

Comments
 (0)