RadiantQ jQuery Gantt Package
Enabling Undo/Redo
Previous Topic  Next Topic 

Enabling Undo/Redo


The GanttControl has support for tracking user actions and building an undo/redo stack that the users can then operate on. You can turn on this feature as follows:


           $('#gantt_container').GanttControl({

                EnableRecordingActions: true,

            });


Once you turn on this feature all operations on the gantt made by the user now gets recorded:


- Moving, Resizing Tasks in the Gantt Chart.

- Connecting Tasks with a dependency in the Gantt Chart.

- Progress percent resize.

- All editing operations in the grid.

- Dragging tasks around in the grid, to change their order.

- Expand/Collapse of tasks in the view.

- etc.


Note that when you enable Undo in the gantt, all operations made on the gantt should go through this ActionManager, otherwise undo actions become unreliable. In other words, you should not make any changes on the gantt model programmatically without going through the ActionManager. Refer to this topic on how to add custom actions to the ActionManager.


This is illustrated in this samples:


In HTML                : ..\Samples\GanttControlUndoRedo.htm.


Undo and Redo


You can then allow users to Undo or Redo actions on the top of the stack using the following APIs:

var ganttControl = $('#gantt_container').data('GanttControl');

// To Undo the action on top of the undo stack

ganttControl.ActionManager.Undo();


// To Redo the action on top of the redo stack

ganttControl.ActionManager.Redo();


Undo / Redo List


The list of Undo / Redo commands is exposed by the ActionManager in this list:

var undoList = ganttControl.ActionManager.EnumUndoableActions();

var redoList = ganttControl.ActionManager.EnumRedoableActions();


You can use this to a UI list (ListControl, ComboBox, etc.) to show your users the list of actions in the undo/redo stack.


Note: Multiple indent/outdent feature will not support when undo/redo feature is enabled.



© RadiantQ 2022. All Rights Reserved.