Control Z not undoing commandManager actions

Posted by: jeff on 9 March 2020, 11:01 am EST

  • Posted 9 March 2020, 11:01 am EST

    1. Select a cell and set the cell red “set BackColor” Button
    2. Press Control Z
    3. The red background does not undo
    4. Unselect the cell
    5. Press: https://www.grapecity.com/spreadjs/demos/features/worksheet/custom-action/purejs
  • Posted 9 March 2020, 5:10 pm EST

    Excuse me I forgot to add the bug description. The bug is that undo events from the key command “command + z” do not work until you unselect a cell.

  • Posted 10 March 2020, 4:23 pm EST

    Hi Jeff,

    This is actually not a bug but the expected behavior. What’s happening here is that when we click the “set BackColor” button, the SpreadJS workbook loses focus and focus is moved to the “set BackColor” button, that is why “ctrl + z” shortcut doesn’t work until to focus the workbook again by clicking on it.

    Hope this clears, please let us know in case there is still some confusion.

    Regards

    Sharad

  • Posted 25 March 2020, 1:49 pm EST

    Sharad,

    Thanks for the calcification. I would only point out that this is not the default behavior in Google Sheets or Microsoft Excel. Is there a way I can set the focus back to the cell so it works like the other applications?

  • Posted 25 March 2020, 9:13 pm EST

    You may set the focus back to the spread by using focus method. Please refer to the following code snippet and the attached sample demonstrating the same:

    function clickhandler(){
        // perform some action or execute custom commands
        // set focus back to workbook
        spread.focus(true);
    }
    

    API Reference:

    • focus method: https://www.grapecity.com/spreadjs/docs/v13/online/SpreadJS~GC.Spread.Sheets.Workbook~focus.html

    sample.zip

Need extra support?

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

Learn More

Forum Channels