Retain scrolltop on resize (#2358)

This commit is contained in:
Andrew Henry 2019-04-05 09:56:31 -07:00 committed by Pegah Sarram
parent 517a40a32b
commit baf410a364

View File

@ -588,13 +588,18 @@ export default {
let el = this.$el;
let width = el.clientWidth;
let height = el.clientHeight;
let scrollTop = this.scrollable.scrollTop;
this.resizePollHandle = setInterval(() => {
if ((el.clientWidth !== width || el.clientHeight !== height) && this.isAutosizeEnabled) {
this.calculateTableSize();
// On some resize events scrollTop is reset to 0. Possibly due to a transition we're using?
// Need to preserve scroll position in this case.
this.scrollable.scrollTop = scrollTop;
width = el.clientWidth;
height = el.clientHeight;
}
scrollTop = this.scrollable.scrollTop;
}, RESIZE_POLL_INTERVAL);
},