Programaticaly doing Undo and Redo not working

Posted by: datta on 29 April 2019, 7:18 am EST

    • Post Options:
    • Link

    Posted 29 April 2019, 7:18 am EST

    Hi All ,

    I have 2 buttons for doing undo and redo operations on spreadsheet. On click of these buttons I am invoking the below code

    
    var undoManager = new GC.Spread.Commands.UndoManager();
    function undo(){
    	if(undoManager)
    	undoManager.undo();
    }
    function redo(){
    	if(undoManager)
    	undoManager.redo();
    }
    
    $('#undo').click(function(){
    undo();
    });
    $('#redo').click(function(){
    redo();
    })
    
    

    But this code is not working. When I click on undo or redo nothing is happening.

  • Posted 30 April 2019, 12:43 am EST

    Hi,

    You need to use the UndoManager for the Workbook. Please refer to the following code snippet:

    var spreadInstance = new GC.Spread.Sheets.Workbook(document.getElementById('ss'));
    var undoManager = spreadInstance.undoManager();
    
    function undo(){
        if(undoManager)
            undoManager.undo();
    }
    function redo(){
        if(undoManager)
            undoManager.redo();
    }
    
    $('#undo').click(function(){
        undo();
    });
    $('#redo').click(function(){
        redo();
    });
    

    Regards

  • Posted 30 April 2019, 1:51 am EST

    Thank you for the reply. That worked !!

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels