Skip to content

Commit

Permalink
Fixed #11948 - The scrollToVirtualIndexmethod is not working as expec…
Browse files Browse the repository at this point in the history
…ted on Table
  • Loading branch information
mertsincan committed Nov 8, 2022
1 parent bbdaebd commit e05b79d
Showing 1 changed file with 4 additions and 9 deletions.
13 changes: 4 additions & 9 deletions src/app/components/scroller/scroller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -590,16 +590,11 @@ export class Scroller implements OnInit, AfterContentInit, AfterViewChecked, OnD
const scrollTo = (left = 0, top = 0) => this.scrollTo({ left, top, behavior });

if (this.both) {
const newFirst = { rows: calculateFirst(index[0], numToleratedItems[0]), cols: calculateFirst(index[1], numToleratedItems[1]) };
if (newFirst.rows !== this.first.rows || newFirst.cols !== this.first.cols) {
scrollTo(calculateCoord(newFirst.cols, this._itemSize[1], contentPos.left), calculateCoord(newFirst.rows, this._itemSize[0], contentPos.top));
}
this.first = { rows: calculateFirst(index[0], numToleratedItems[0]), cols: calculateFirst(index[1], numToleratedItems[1]) };
scrollTo(calculateCoord(this.first.cols, this._itemSize[1], contentPos.left), calculateCoord(this.first.rows, this._itemSize[0], contentPos.top));
} else {
const newFirst = calculateFirst(index, numToleratedItems);

if (newFirst !== this.first) {
this.horizontal ? scrollTo(calculateCoord(newFirst, this._itemSize, contentPos.left), 0) : scrollTo(0, calculateCoord(newFirst, this._itemSize, contentPos.top));
}
this.first = calculateFirst(index, numToleratedItems);
this.horizontal ? scrollTo(calculateCoord(this.first, this._itemSize, contentPos.left), 0) : scrollTo(0, calculateCoord(this.first, this._itemSize, contentPos.top));
}
}

Expand Down

0 comments on commit e05b79d

Please sign in to comment.