Get Free Trial

Using updateData in flat view changes scroll

Jimmy asked on September 1, 2021

When having a vertical scrollbar in the grin and scrolling all the way to the right.
If you then call “updateData”  using with “partial: true” this resets the scroll to the left side:

3 answers

Illia Yatsyshyn Illia Yatsyshyn Flexmonster September 1, 2021

Hello, Jimmy,
Thank you for reaching out to us.
We suggest executing the following code snippet before actual data update to restore scroll position:

const scrollPane = document.querySelector(".fm-data-sheet > div");
const initialPosition = {
x: scrollPane.scrollLeft,
y: scrollPane.scrollTop
pivot.on("aftergriddraw", () => {"aftergriddraw");
setTimeout(() => {
scrollPane.scrollTo(initialPosition.x, initialPosition.y);
}, 0);

It allows saving scroll position before the data was updated and restore it after the render is complete.
Here is JSFiddle demonstrating this approach:
Please let us know if it helps.
Kind regards,

Jimmy September 1, 2021

Hello Illia,
Thanks this works for the vertical scroll.
But using it with the horizontal scroll it doesn’t scroll all the way: horizontal


Illia Yatsyshyn Illia Yatsyshyn Flexmonster September 2, 2021

Thank you for your feedback.
Please note that this is only the workaround that may produce slight differences in a horizontal scroll on the flat form. This is due to possible differences in columns’ width after the data update.
Currently, there are no other workarounds for this case.
Please contact us if other questions arise.
Kind regards,

Please login or Register to Submit Answer