ExtJS 4网格面板-空格键行切换 [英] ExtJS 4 Grid Panel - Spacebar row toggle
本文介绍了ExtJS 4网格面板-空格键行切换的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在ExtJS 4中,在网格面板"中选择一行(通过单击),然后按空格键选择并取消选择该行.在ExtJS 3中不是这样,我想禁用此功能.
In ExtJS 4, selecting a row in a Grid Panel (by clicking it), and pressing the spacebar selects and de-selects the row. It was not like this in ExtJS 3, and I would like to disable this feature.
有什么想法吗?我已经开始研究Ext.util.KeyMap
,看看是否可以以某种方式覆盖它.预先感谢.
Any ideas? I've begin looking into Ext.util.KeyMap
to see if I could override it somehow. Thanks in advance.
推荐答案
您必须覆盖Ext.selection.RowModel
的onKeyPress
方法.出厂的实现是
You have to override the onKeyPress
method of the Ext.selection.RowModel
. The shipped implementation is
onKeyPress: function(e, t) {
if (e.getKey() === e.SPACE) {
e.stopEvent();
var me = this,
record = me.lastFocused;
if (record) {
if (me.isSelected(record)) {
me.doDeselect(record, false);
} else {
me.doSelect(record, true);
}
}
}
}
不幸的是,目前没有配置开关可以关闭该行为.
Unfortunately there currently is no configuration switch to turn off that behavior.
这篇关于ExtJS 4网格面板-空格键行切换的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文