Scroll bar issue when Dynamic Loading Data


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 ?

You can try using the following method:

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:

Since the 6.2.4 version, Gantt no longer collapses the parent tasks that are reloaded with the parse method: