Spread for ASP.NET 10 Product Documentation > Client-Side Scripting Reference > Scripting Members > Methods > AddKeyMap |
This method allows you to map a keyboard key which will cause an action.
[JavaScript]
FpSpread1.AddKeyMap(keycode,ctrl,shift,alt,action);
None
This method allows you to set a JavaScript code action based on a key the user presses. The action can move to the next or previous cell or row, first or last column, or scroll to a cell.
This is a sample that contains the method. On the client side, the script that contains the method would look like this:
JavaScript |
Copy Code
|
---|---|
<script type="text/javascript"> function setMap() { var ss = document.getElementById("FpSpread1"); if (ss != null){ //IE9 or earlier //ss.AddKeyMap(13,true,true,false,"this.MoveToLastColumn()"); ss.AddKeyMap(13,true,true,false,"element.MoveToLastColumn()"); } </script> |
The following code passes a function to the AddKeyMap method. This code works for Microsoft Internet Explorer (IE) and Mozilla Firefox.
JavaScript |
Copy Code
|
---|---|
window.onload = function() { var spread1 = document.getElementById("FpSpread1"); spread1.AddKeyMap(13, false, false, false, function() { var ss = spread1; ss.MoveToLastColumn(); }); } |