SpreadJS Documentation
Using Undo and Redo

You can use Ctrl + Z to undo an action in the widget. You can then use Ctrl + Y to redo the action you canceled.

You can undo the following types of actions:

The following actions do not respond to Ctrl + Z:

You can prevent or allow the undo action in code with the allowUndo method.

Using Code

This example sets the allowUndo method and specifies an action.

JavaScript
Copy Code
spread.allowUndo(true);
var group = new GcSpread.Sheets.UndoRedo.GroupExtent(3,5);
var action = new GcSpread.Sheets.UndoRedo.RowGroupUndoAction(activeSheet,group);
spread.doCommand(action);
activeSheet.isPaintSuspended(false);
activeSheet.repaint();

The following code can be used to undo or redo an action.

JavaScript
Copy Code
var sheet = spread.getActiveSheet();
            $("#testUndo").click(function () {
                GcSpread.Sheets.SpreadActions.undo.apply(sheet);
            });
            $("#testRedo").click(function () {
               GcSpread.Sheets.SpreadActions.redo.apply(sheet);
            });
See Also

 

 


Copyright © GrapeCity, inc. All rights reserved.

Send comments on this topic.