Spread.Sheets Documentation
Creating a Custom Action Map
Spread.Sheets Documentation > Sample Code > Sample Code for Keyboard and Input Maps > Creating a Custom Action Map

You can create a custom action map.

Using Code

This example creates a custom action map for the Enter key.

JavaScript
Copy Code

var spread = new GC.Spread.Sheets.Workbook(document.getElementById("ss"),{sheetCount:3});
var activeSheet = spread.getActiveSheet();

spread.commandManager().register('myCmd',
                function ColorAction() {                   
                    //Click on a cell and press the Enter key.
                    activeSheet.getCell(activeSheet.getActiveRowIndex(), activeSheet.getActiveColumnIndex()).backColor("red");
                }
            );

//Map the created action to the Enter key.
spread.commandManager().setShortcutKey('myCmd', GC.Spread.Commands.Key.enter, false, false, false, false);

See Also

Developer's Guide