Stop Autofocus on task change


#1

Hello everyone,

This might be an issue of my own but I wanted to know if it is possible to remove the autofocus on task change. Everytime I edit a task and hit enter or just click outside of it the scroll bar (vertical) moves all the way to the top, when I have to edit multiple tasks and the quantity is high it gets really unproductive to scroll down everytime.

Can anyone help? Thanks!


#2

Hello Daniel,
You need to make sure that the preserve_scroll parameter is enabled, and you can turn off the initial_scroll parameter:
https://docs.dhtmlx.com/gantt/api__gantt_preserve_scroll_config.html
https://docs.dhtmlx.com/gantt/api__gantt_initial_scroll_config.html
Here is an example:
https://snippet.dhtmlx.com/5/c2d218e6a

If you reinitialize Gantt after editing a task, it is expected that Gantt scrolls to the top as the scroll position is not saved. You need to manually do that.
Here are examples of how it might be implemented:
http://snippet.dhtmlx.com/8603c6946
http://snippet.dhtmlx.com/f59707829

If that doesn’t help you, probably the issue is related to Gantt configuration. But it is hard to suggest what might be wrong as I don’t see your code.
In that case, please, reproduce the issue in the snippet, then click on the “Share” button and send me the link:
https://snippet.dhtmlx.com/38ee1b370
Or send me a ready demo with all the necessary Javascript and CSS files so that I can reproduce the issue locally.