Posted 9 March 2020, 11:01 am EST
- Select a cell and set the cell red “set BackColor” Button
- Press Control Z
- The red background does not undo
- Unselect the cell
- Press: https://www.grapecity.com/spreadjs/demos/features/worksheet/custom-action/purejs
Forums Home / Spread / SpreadJS
Posted by: jeff on 9 March 2020, 11:01 am EST
Posted 9 March 2020, 11:01 am EST
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