如何在extjs中创建快捷键 [英] how to create shortcut keys in extjs
本文介绍了如何在extjs中创建快捷键的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我写这个代码供进入
{
fieldLabel : 'Password',
name : 'j_password',
inputType : 'password',
allowBlank : false,
listeners : {
'render' : function(cmp) {
cmp.getEl().on('keypress', function(e) {
if (e.getKey() == e.ENTER) {
submitform();
}
});
}
}
}
我需要做什么改变对于快捷键喜欢保存(Ctrl + S)
,粘贴(Ctrl + P)
,打开(Ctrl + O)
,退出(Ctrl + X)
what change i need to do for shortcut keys Like Save(Ctrl + S)
,Paste(Ctrl +P)
, Open (Ctrl + O)
, Exit(Ctrl +X)
推荐答案
您需要使用KeyMap编写适当的处理程序来完成这项工作。
Ext 4代码片段可能如下 -
You need to write appropriate handler to do the job using KeyMap. Ext 4 code snippet may be as follows -
Ext.onReady(function () {
var map = new Ext.util.KeyMap(document,{
key: [VALUES-ASCII], // this works,
fn: function(){ alert('key was pressed.!'); }
}
);
});
这篇关于如何在extjs中创建快捷键的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文