Skip to content

Commit 7db787a

Browse files
MKirovaMKirova
authored andcommitted
chore(*): Fix scrollTo when scrolling to a merged cell that has larger rowspan.
1 parent 1e560e8 commit 7db787a

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

projects/igniteui-angular/src/lib/grids/grid-base.directive.ts

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7633,15 +7633,21 @@ export abstract class IgxGridBaseDirective implements GridType,
76337633
this.page = page;
76347634
}
76357635
}
7636-
7636+
let targetRowIndex = (typeof (row) === 'number' ? row : this.unpinnedDataView.indexOf(row));
7637+
const virtRec = this.verticalScrollContainer.igxForOf[targetRowIndex];
7638+
const col = typeof (column) === 'number' ? this.visibleColumns[column] : column;
7639+
const rowSpan = this.isRecordMerged(virtRec) ? virtRec?.cellMergeMeta.get(col)?.rowSpan : 1;
7640+
if (rowSpan > 1) {
7641+
targetRowIndex += Math.floor(rowSpan/2);
7642+
}
76377643
if (delayScrolling) {
76387644
this.verticalScrollContainer.dataChanged.pipe(first(), takeUntil(this.destroy$)).subscribe(() => {
76397645
this.scrollDirective(this.verticalScrollContainer,
7640-
typeof (row) === 'number' ? row : this.unpinnedDataView.indexOf(row));
7646+
targetRowIndex);
76417647
});
76427648
} else {
76437649
this.scrollDirective(this.verticalScrollContainer,
7644-
typeof (row) === 'number' ? row : this.unpinnedDataView.indexOf(row));
7650+
targetRowIndex);
76457651
}
76467652

76477653
this.scrollToHorizontally(column);

0 commit comments

Comments
 (0)