[New] Fixed scrolling after paging
This commit is contained in:
parent
d9206fc4fa
commit
04cdcbdf59
|
@ -1,7 +1,7 @@
|
||||||
{
|
{
|
||||||
"name": "strolch-wc-paging",
|
"name": "strolch-wc-paging",
|
||||||
"description": "Strolch WebComponent Paging",
|
"description": "Strolch WebComponent Paging",
|
||||||
"version": "0.2.0",
|
"version": "0.2.1",
|
||||||
"authors": [
|
"authors": [
|
||||||
"Robert von Burg"
|
"Robert von Burg"
|
||||||
],
|
],
|
||||||
|
|
|
@ -16,6 +16,10 @@
|
||||||
previousOffset: 0,
|
previousOffset: 0,
|
||||||
lastOffset: 0
|
lastOffset: 0
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
scrollTarget: {
|
||||||
|
type: Object,
|
||||||
|
value: null
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -75,6 +79,18 @@
|
||||||
this.ajax.params.limit = this.dataObj.limit;
|
this.ajax.params.limit = this.dataObj.limit;
|
||||||
this.ajax.params.offset = this.dataObj.offset;
|
this.ajax.params.offset = this.dataObj.offset;
|
||||||
this.ajax.generateRequest();
|
this.ajax.generateRequest();
|
||||||
|
this.ajax.addEventListener('response', this);
|
||||||
|
},
|
||||||
|
handleEvent: function (event) {
|
||||||
|
if (event.type !== "response")
|
||||||
|
return;
|
||||||
|
|
||||||
|
this.ajax.removeEventListener('response', this);
|
||||||
|
if (this.scrollTarget != null) {
|
||||||
|
this.scrollTarget.scrollIntoView({behavior: "smooth", block: "start", inline: "start"});
|
||||||
|
} else {
|
||||||
|
window.scrollTo({top: 0, left: 0, behavior: "smooth"});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
Loading…
Reference in New Issue