Skip to main content Skip to footer

No F2 key in SpreadJS?

In Excel, you can use F2 key to start editing in a cell. If you try it in SpreadJS, you will find F2 doesn't work. Does SpreadJS not support it? Actually, we may say SpreadJS doesn't have F2 in default, because function key is usually engaged by the browser. But there is still possibility to add F2 key behavior by using addKeyMap method which is used to customize keyboard behavior of SpreadJS. It is very simple, what you need to do is just add following code after SpreadJS initializing: sheet.addKeyMap(113, false, false, false, false, function () { if (!sheet.isEditing()) { sheet.startEdit(); } }); If you want to all text is selected after enter editing mode, startEdit method has a parameter allow you to do it. sheet.startEdit(true); For more information about addKeyMap, startEdit API, and how to use SpreadJS in a web page, you may go to SpreadJS web page and visit the docs and samples.

MESCIUS inc.

comments powered by Disqus