Skip to content

Commit 8590a00

Browse files
MKirovaMKirova
authored andcommitted
chore(*): Fix issue with nav when moving between different row dimension siblings.
1 parent 82a6996 commit 8590a00

File tree

2 files changed

+24
-0
lines changed

2 files changed

+24
-0
lines changed

projects/igniteui-angular/src/lib/directives/for-of/for_of.directive.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -721,6 +721,17 @@ export class IgxForOfDirective<T> implements OnInit, OnChanges, DoCheck, OnDestr
721721
return scroll;
722722
}
723723

724+
725+
/**
726+
* Returns the index of the element at the specified offset.
727+
* ```typescript
728+
* this.parentVirtDir.getIndexAtScroll(100);
729+
* ```
730+
*/
731+
public getIndexAtScroll(scrollOffset: number) {
732+
return this.getIndexAt(scrollOffset, this.sizesCache);
733+
}
734+
724735
/**
725736
* @hidden
726737
* Function that recalculates and updates cache sizes.

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

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,19 @@ export class IgxPivotGridNavigationService extends IgxGridNavigationService {
4545
if ((key.includes('down')) && this.activeNode.row < this.findLastDataRowIndex()) {
4646
newActiveNode.row = ctrl ? this.findLastDataRowIndex() : this.activeNode.row + 1;
4747
}
48+
49+
if (key.includes('left') || key.includes('right')) {
50+
const prevRIndex = this.activeNode.row;
51+
const prevScrContainer = this.grid.verticalRowDimScrollContainers.toArray()[this.activeNode.column];
52+
const src = prevScrContainer.getScrollForIndex(prevRIndex);
53+
newActiveNode.row = this.activeNode.mchCache && this.activeNode.mchCache.level === newActiveNode.column ?
54+
this.activeNode.mchCache.visibleIndex :
55+
verticalContainer.getIndexAtScroll(src);
56+
newActiveNode.mchCache = {
57+
visibleIndex: this.activeNode.row,
58+
level: this.activeNode.column
59+
};
60+
}
4861
this.setActiveNode(newActiveNode);
4962
verticalContainer.scrollTo(newActiveNode.row);
5063
} else {

0 commit comments

Comments
 (0)