Retain Changes in Gantt Dataset Upon ResetLayout

Hello,

I would like to confirm if the changes made to the Gantt dataset are retained when calling gantt.init() or gantt.resetLayout(). Additionally, does this impact the undo stack? Also, if I have Gantt instances attached to two dhxLayout, what happens when I hide one of the Gantt charts? Will its changes be retained when the layout cell is hidden and then shown again? The changes I’m referring here are the changes recorded in the undo stack.

Hello Cairo,

I would like to confirm if the changes made to the Gantt dataset are retained when calling gantt.init() or gantt.resetLayout().
Additionally, does this impact the undo stack?

When you use the init and resetLayout methods, Gantt only changes the layout configuration and repaints tasks. It doesn’t modify the task data or the Undo and Redo stacks.
You can check how it works in the following snippet:
https://snippet.dhtmlx.com/dl7moz1c


Also, if I have Gantt instances attached to two dhxLayout, what happens when I hide one of the Gantt charts? Will its changes be retained when the layout cell is hidden and then shown again? The changes I’m referring here are the changes recorded in the undo stack.

It depends on how it is implemented in your case. If you destroy the Gantt instance when you hide the layout cell with Gantt, you can no longer restore the data and configuration unless you save it somewhere.
However, it seems that the Undo and Redo stacks are not removed.

But when you create a new Gantt instance all Gantt settings are reset. And that includes the stacks.

Here is an example:
https://snippet.dhtmlx.com/f3c61ugo

So, if you don’t create a new Gantt instance, the stacks will remain:
https://snippet.dhtmlx.com/8nzdbj2u

1 Like