Check documentation for the latest version of dhtmlxSuite Providing Undo/Redo Operations DHTMLX Docs

Providing Undo/Redo Operations

dhtmlxGrid provides users with the ability to interactively undo and redo editing operations performed on data items.
But note, modifications caused by API calls cannot be undone.

The stated functionality requires PRO version of the dhtmlxGrid (or DHTMLX Suite) package.

An operation can be undone only when a user has performed at least one edit operation. The redo command is unavailable unless you have used the undo command.


Enabling the undo/redo commands in the grid

<input type="button" name="a1" value="Back" onClick="mygrid.doUndo()">
<input type="button" name="a2" value="Forward" onClick="mygrid.doRedo()">
<div id="gridbox" style="width:400px;height:270px;"></div>
 
<script>        
    mygrid = new dhtmlXGridObject('gridbox');
    mygrid.enableUndoRedo();
    ...
</script>


Table 1 The Undo/Redo system methods
Method Description
enableUndoRedo() enables the undo/redo commands in the grid
disableUndoRedo() disables the undo/redo commands in the grid
doUndo() undoes an editing operation
doRedo() redoes an editing operation
getUndo().length returns a number of the stored editing operations available for the undo command
getRedo().length returns a number of the stored editing operations available for the redo command

Related sample:  Undo/Redo

Back to top