SpreadJS Documentation
Using Input Mapping

You can change the keyboard keys that are used to trigger built-in actions to other keys. Actions include navigation, selection, cut, copy, paste, clear, undo, and redo.

Using Code

This example specifies the keys for moving left.

JavaScript
Copy Code
//use Control+Shift+n
activeSheet.addKeyMap("N".charCodeAt(0), true, true, false, false, GcSpread.Sheets.SpreadActions.navigationLeft);

Using Code

This example changes the action of the default up and down arrow keys for the active cell.

JavaScript
Copy Code
var activeSheet = spread.getActiveSheet();
   //Change the default Up arrow key action to "Page Up" for the active cell.
    activeSheet.addKeyMap(GcSpread.Sheets.Key.up, false, false, false, false, GcSpread.Sheets.SpreadActions.navigationPageUp);
    //Change the default Down arrow key action to "Page Down" for the active cell.
    activeSheet.addKeyMap(GcSpread.Sheets.Key.down, false, false, false, false, GcSpread.Sheets.SpreadActions.navigationPageDown);

Using code

This example creates a custom action.

JavaScript
Copy Code
var activeSheet = spread.getActiveSheet();

//Map the created action to the Enter key.
activeSheet.addKeyMap(GcSpread.Sheets.Key.enter, false, false, false, false, ColorAction);

function ColorAction(){
//Click on a cell and press the Enter key.
activeSheet.getCell(activeSheet.getActiveRowIndex(), activeSheet.getActiveColumnIndex())
        .backColor("red");
}
See Also

 

 


Copyright © GrapeCity, inc. All rights reserved.

Send comments on this topic.