Fixed #7095 - Virtual Scroller: Event first and last behave differently

pull/7129/head
tugcekucukoglu 2025-01-20 15:41:36 +03:00
parent a8cc66d391
commit 7b9e98a811
1 changed files with 2 additions and 2 deletions

View File

@ -313,7 +313,7 @@ export default {
Promise.resolve().then(() => {
this.lazyLoadState = {
first: this.step ? (both ? { rows: 0, cols: first.cols } : 0) : first,
last: Math.min(this.step ? this.step : last, this.items?.length || 0)
last: Math.min(this.step ? this.step : last, this.items?.length - 1 || 0)
};
this.$emit('lazy-load', this.lazyLoadState);
@ -513,7 +513,7 @@ export default {
if (this.lazy && this.isPageChanged(first)) {
const lazyLoadState = {
first: this.step ? Math.min(this.getPageByFirst(first) * this.step, (this.items?.length || 0) - this.step) : first,
last: Math.min(this.step ? (this.getPageByFirst(first) + 1) * this.step : last, this.items?.length || 0)
last: Math.min(this.step ? (this.getPageByFirst(first) + 1) * this.step : last, this.items?.length - 1 || 0)
};
const isLazyStateChanged = this.lazyLoadState.first !== lazyLoadState.first || this.lazyLoadState.last !== lazyLoadState.last;