SpreadJS Documentation > Sample Code > Sample Code for Keyboard and Input Maps > Creating a Custom Action Map |
You can create a custom action map.
This example creates a custom action map for the Enter key.
JavaScript |
Copy Code
|
---|---|
$(document).ready(function () { var spread = new GcSpread.Sheets.Spread($("#ss").get(0),{sheetCount:3}); var activeSheet = spread.getActiveSheet(); //Map the created action to Enter key. activeSheet.addKeyMap(GcSpread.Sheets.Key.enter, false, false, false, false, ColorAction); }); function ColorAction(){ //Obtain active sheets. var spread = $("#ss").data("spread"); var activeSheet = spread.getActiveSheet(); //Configure background colors for those active cells. activeSheet.getCell(activeSheet.getActiveRowIndex(), activeSheet.getActiveColumnIndex()) .backColor("red"); } |