I am mapping some data that comes from my backend and each time it changes I execute the follwing methods:
gantt.clearAll()
gantt.parse({tasks: tasks, links: links})
I suppose when I execute clearAll the gantt scroll gets reset and when parse gets executed the position cannot be recovered.
Is there any other way to update the tasks without having to execute “clearAll”?
Hello,
Is there any other way to update the tasks without having to execute “clearAll”?
The scroll position will be preserved when using the updateTask
, deleteTask
, and addTask
methods.
You can also restore the previous scroll position after clearAll
using the scrollTo
method:
const scrollPosition = gantt.getScrollState()
gantt.clearAll()
gantt.parse(data);
gantt.scrollTo(scrollPosition.x, scrollPosition.y);
Here is an example: DHTMLX Snippet Tool
1 Like