Hello
I tried the functionality you mentioned above.
It works properly only if the user is in the middle of the report table.
For example if user removes very last column, then the scroller appears a little away than the last column․
But I noticed that this happens if there are more than 38 columns.
Hello, Tigran!
Kindly note that by design, Flexmonster scrolls to the far left end of the grid every time the field is removed. This behavior can be overridden by using Flexmonster beforegriddraw
, aftergriddraw
, reportcomplete
and reportchange
events along with scrollTo()
API call as follows:
let handler = () => {
scrollPane = document.querySelector("#fm-pivot-view div.fm-data-sheet > div.fm-scroll-pane")
x = scrollPane.scrollLeft;
y = scrollPane.scrollTop;
};
pivot.on("reportcomplete", () => {
pivot.on("beforegriddraw", handler)
pivot.on('reportchange', () => {
pivot.off('reportchange');
pivot.off('beforegriddraw', handler);
pivot.on('aftergriddraw', () => {
pivot.off('aftergriddraw');
setTimeout(() => {
scrollPane.scrollTo(x, y);
}, 0);
});
})
});
We have prepared the JSFiddle example for reference: https://jsfiddle.net/flexmonster/r5b4eq2L/.
Hope it helps.
Feel free to contact us in case of any other questions.
Regards,
Solomiia
Hello, Tigran!
Hope you are doing well.
Our team is wondering if you had a chance to test the suggested approach. Could you please let us know if it was helpful?
Looking forward to hearing from you.
Regards,
Solomiia
Hi, Solomiaa!
First I mentioned that this happens when the columns are greater than 38.
But this is not the case.
This happens when X is greater than 5000 or more.
Hello, Tigran!
Thank you for getting back to us.
Kindly note that the suggested approach can't control the scroll with 100% accuracy as we don't save and restore the pixels, only the scroll position.
It is possible to adjust the approach more by catching the last column removed and scrolling to the far right end in this case. For that, you need to compare the fields in the report before and after the reportchange
. The fields can be retrieved by using the getReport() API call.
Hope it helps.
Feel free to contact us in case of any other questions.
Kind regards,
Solomiia
Thanks for your halp.
Hello,
Thank you for the feedback.
As always, feel free to contact us if other questions arise.
Kind regards,
Nadia