SMART datagrid v.1 > Classes > GridBase

Back  Forward

DataLudi.GridBase.canUndo  method

If undoable is true, when there is at least one updated cell which can be reverted from the updating or appending row, or the data set connected to the grid is enabled to run Redo, it will return true

If Undo stack of grid or data set is changed, onUndoStateChanged event will be fired, and you can also know whether undo/redo is enabled through this event. 

Please refer to Undoing Overview for more descriptions about Undo/Redo implementation of SMART datagrid. 

function canUndo (): Boolean;
Returns
Boolean
Code -1
    document.getElementById('btnUndo').disabled = !grid.canUndo();
    document.getElementById('btnRedo').disabled = !grid.canRedo();
Code -2
    $("#btnUndo").click = function () {
        grid.canUndo() && grid.undo();
    });
See Also
Undoing Overview
undoable
canRedo
undo
redo
clearUndo
onUndoStateChanged
EditOptions.updatable
EditOptions.insertable
EditOptions.appendable
Examples
Undo & Redo