Closed
Description
Description
navigateTo method does not scroll grid vertically when both row index and column index are provided.
- igniteui-angular version: 8.2.0
- browser: n/a
Steps to reproduce
- Run the attached sample
- Click "Go to middle of the grid" button
Result
navigateTo(11, 15) is called however vertical scroll is not triggered.
Expected result
navigateTo(11, 15) is called so that the grid scroll to show the 11th row in viewport.
Attachments
Attach a sample if available, and screenshots, if applicable.
igx-grid-scroll-position.zip
Note
If performVerticalScrollToCell() is called at the end of navigateTo method, the grid works as expected.
public navigateTo(rowIndex: number, visibleColIndex = -1, cb: Function = null) {
if (rowIndex < 0 || rowIndex > this.verticalScrollContainer.igxForOf.length - 1
|| (visibleColIndex !== -1 && this.columnList.map(col => col.visibleIndex).indexOf(visibleColIndex) === -1)) {
return;
}
this.wheelHandler();
if (this.verticalScrollContainer.igxForOf.slice(rowIndex, rowIndex + 1).find(rec => rec.expression || rec.childGridsData)) {
visibleColIndex = -1;
}
if (visibleColIndex === -1 || this.navigation.isColumnFullyVisible(visibleColIndex)) {
if (this.navigation.shouldPerformVerticalScroll(rowIndex, visibleColIndex)) {
this.navigation.performVerticalScrollToCell(rowIndex, visibleColIndex,
() => { this.executeCallback(rowIndex, visibleColIndex, cb); });
} else {
this.executeCallback(rowIndex, visibleColIndex, cb);
}
} else {
this.navigation.performHorizontalScrollToCell(rowIndex, visibleColIndex, false,
() => { this.executeCallback(rowIndex, visibleColIndex, cb); });
// add the following
this.navigation.performVerticalScrollToCell(rowIndex, visibleColIndex,
() => { this.executeCallback(rowIndex, visibleColIndex, cb); });
}
}