Fixed #4723 - DataTable: #loading templates broken with lazy virtual scroller

This commit is contained in:
mertsincan 2023-12-20 13:07:52 +00:00
parent d56461080c
commit 5663e4e879
2 changed files with 73 additions and 67 deletions

View file

@ -83,8 +83,10 @@ export default {
numToleratedItems(newValue) {
this.d_numToleratedItems = newValue;
},
loading(newValue) {
this.d_loading = newValue;
loading(newValue, oldValue) {
if (this.lazy && newValue !== oldValue && newValue !== this.d_loading) {
this.d_loading = newValue;
}
},
items(newValue, oldValue) {
if (!oldValue || oldValue.length !== (newValue || []).length) {
@ -506,26 +508,28 @@ export default {
onScroll(event) {
this.$emit('scroll', event);
if (this.delay && this.isPageChanged()) {
if (this.delay) {
if (this.scrollTimeout) {
clearTimeout(this.scrollTimeout);
}
if (!this.d_loading && this.showLoader) {
const { isRangeChanged } = this.onScrollPositionChange(event);
const changed = isRangeChanged || (this.step ? this.isPageChanged() : false);
if (this.isPageChanged()) {
if (!this.d_loading && this.showLoader) {
const { isRangeChanged } = this.onScrollPositionChange(event);
const changed = isRangeChanged || (this.step ? this.isPageChanged() : false);
changed && (this.d_loading = true);
}
this.scrollTimeout = setTimeout(() => {
this.onScrollChange(event);
if (this.d_loading && this.showLoader && (!this.lazy || this.loading === undefined)) {
this.d_loading = false;
this.page = this.getPageByFirst();
changed && (this.d_loading = true);
}
}, this.delay);
this.scrollTimeout = setTimeout(() => {
this.onScrollChange(event);
if (this.d_loading && this.showLoader && (!this.lazy || this.loading === undefined)) {
this.d_loading = false;
this.page = this.getPageByFirst();
}
}, this.delay);
}
} else {
this.onScrollChange(event);
}