Scroll bar issue when Dynamic Loading Data

Hi,

I’m dynamically loading dhtml gantt to display my data when expand is clicked. After fetching the data i’m calling gantt.parse(data); gantt.render(); to display the loaded data. However after the data is rendered the scrollbar always moves to starting of gantt.

How we can maintain the scroll position ?

Also i have tried to do this using gantt.showTask() but it makes the screen look jumpy. It goes to the top and again comes back to the task which doesn’t look good. Is there any other approach ?

Hello,
You can try using the following method:
https://docs.dhtmlx.com/gantt/api__gantt_preserve_scroll_config.html

Usually, when you parse the data and update tasks that already exist, Gantt collapses them. That’s why just adding that method doesn’t always help. Before parsing the data you can store the IDs of all open tasks and during the parse you open tasks. And the method to keep scroll position should work. Here is the snippet:

http://snippet.dhtmlx.com/374b09cb2

Update:
Since the 6.2.4 version, Gantt no longer collapses the parent tasks that are reloaded with the parse method:
https://docs.dhtmlx.com/gantt/whatsnew.html#624