UndoManager clear method

Posted by: achort on 17 November 2021, 6:38 am EST

    • Post Options:
    • Link

    Posted 17 November 2021, 6:38 am EST

    Hi,

    I’m using the Designer component and want to clear the undo stack.

    I’m using the ‘clear’ method from the UndoManager class like this:

    designer.Spread.undoManager().clear()
    

    Although the stack is effectively empty I do see the undo/redo icons enabled in the Designer. After clicking on the button it goes to the disabled state. Also, if I try to expand the undo/redo list I see this error in the browser’s console:

    gc.spread.sheets.designer.all.14.2.0.min.js:1 Uncaught TypeError: Cannot read properties of null (reading 'querySelector')
        at e.scrollToSelect (gc.spread.sheets.designer.all.14.2.0.min.js:1)
        at e.l.afterOpen (gc.spread.sheets.designer.all.14.2.0.min.js:1)
        at e.u.Open (gc.spread.sheets.designer.all.14.2.0.min.js:1)
        at f._popupActionStack (gc.spread.sheets.designer.all.14.2.0.min.js:1)
        at HTMLDivElement.b.tabPanelItemsClickEventHandler (gc.spread.sheets.designer.all.14.2.0.min.js:1)
    

    Am I doing something wrong or is this a known bug?

    Thank you,

    Andres

  • Posted 17 November 2021, 10:26 pm EST

    Hi Andres,

    For updating the designer we need to call the refresh method after clearing the undo stack. Please refer to the following code snippet and let me you face any issues.

    
    designer.Spread.undoManager().clear()
    designer.refesh();
    
    

    API references:

    refresh: https://www.grapecity.com/spreadjs/docs/v14/online/SpreadJSDesigner~GC.Spread.Sheets.Designer.Designer~refresh.html

    Regards

    Avinash

Need extra support?

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

Learn More

Forum Channels