Fixed #2715 - DropDown: Filter with Virtual Scroll does not work as expected

pull/2741/head
mertsincan 2022-06-30 22:38:07 +01:00
parent 819da95142
commit 2f3c210a8e
2 changed files with 3 additions and 2 deletions

View File

@ -617,6 +617,8 @@ export default {
onFilterChange(event) { onFilterChange(event) {
this.filterValue = event.target.value; this.filterValue = event.target.value;
this.$emit('filter', {originalEvent: event, value: event.target.value}); this.$emit('filter', {originalEvent: event, value: event.target.value});
!this.virtualScrollerDisabled && this.virtualScroller.scrollToIndex(0);
}, },
onFilterUpdated() { onFilterUpdated() {
if (this.overlayVisible) { if (this.overlayVisible) {

View File

@ -143,6 +143,7 @@ export default {
return this.orientation === 'both'; return this.orientation === 'both';
}, },
scrollTo(options) { scrollTo(options) {
this.lastScrollPos = this.isBoth() ? { top: 0, left: 0 } : 0;
this.element && this.element.scrollTo(options); this.element && this.element.scrollTo(options);
}, },
scrollToIndex(index, behavior = 'auto') { scrollToIndex(index, behavior = 'auto') {
@ -160,7 +161,6 @@ export default {
const newFirst = { rows: calculateFirst(index[0], numToleratedItems[0]), cols: calculateFirst(index[1], numToleratedItems[1]) }; const newFirst = { rows: calculateFirst(index[0], numToleratedItems[0]), cols: calculateFirst(index[1], numToleratedItems[1]) };
if (newFirst.rows !== first.rows || newFirst.cols !== first.cols) { if (newFirst.rows !== first.rows || newFirst.cols !== first.cols) {
scrollTo(calculateCoord(newFirst.cols, itemSize[1], contentPos.left), calculateCoord(newFirst.rows, itemSize[0], contentPos.top)) scrollTo(calculateCoord(newFirst.cols, itemSize[1], contentPos.left), calculateCoord(newFirst.rows, itemSize[0], contentPos.top))
this.first = newFirst;
} }
} }
else { else {
@ -168,7 +168,6 @@ export default {
if (newFirst !== first) { if (newFirst !== first) {
horizontal ? scrollTo(calculateCoord(newFirst, itemSize, contentPos.left), 0) : scrollTo(0, calculateCoord(newFirst, itemSize, contentPos.top)); horizontal ? scrollTo(calculateCoord(newFirst, itemSize, contentPos.left), 0) : scrollTo(0, calculateCoord(newFirst, itemSize, contentPos.top));
this.first = newFirst;
} }
} }
}, },