SpreadJS Documentation
setShortcutKey Method
GC.Spread.Commands Namespace > CommandManager class : setShortcutKey Method
The command name, setting commandName to undefined removes the bound command of the shortcut key.
The key code, setting the key code to undefined removes the shortcut key of the command.
true if the command uses the Ctrl key; otherwise, false.
true if the command uses the Shift key; otherwise, false.
true if the command uses the Alt key; otherwise, false.
true if the command uses the Command key on the Macintosh or the Windows key on Microsoft Windows; otherwise, false.
Binds a shortcut key to a command.
Syntax
var instance = new GC.Spread.Commands.CommandManager(context);
var value; // Type: any
value = instance.setShortcutKey(commandName, key, ctrl, shift, alt, meta);
function setShortcutKey( 
   commandName : string,
   key : undefined,
   ctrl : boolean,
   shift : boolean,
   alt : boolean,
   meta : boolean
) : any;

Parameters

commandName
The command name, setting commandName to undefined removes the bound command of the shortcut key.
key
The key code, setting the key code to undefined removes the shortcut key of the command.
ctrl
true if the command uses the Ctrl key; otherwise, false.
shift
true if the command uses the Shift key; otherwise, false.
alt
true if the command uses the Alt key; otherwise, false.
meta
true if the command uses the Command key on the Macintosh or the Windows key on Microsoft Windows; otherwise, false.
Example
This example changes the behavior of default keys.
var activeSheet = spread.getActiveSheet();

//Change the default Up arrow key action to "Page Up" for the active cell.
spread.commandManager().setShortcutKey('navigationPageUp', GC.Spread.Commands.Key.up, false, false, false, false);
//Change the default Down arrow key action to "Page Down" for the active cell.
spread.commandManager().setShortcutKey('navigationPageDown', GC.Spread.Commands.Key.down, false, false, false, false);
See Also

Reference

CommandManager class