[英]In ExtJS, Using a DataView, How Can You Detect A Key Held Down?
All, Using Ext JS (3.2), how is it possible to detect whether a user is pressing/holding down a specific key whilst performing another action with a DataView component? 全部,使用Ext JS(3.2),如何在使用DataView组件执行另一个操作的同时检测用户是否按下/按住特定键?
The specific application is to see whether the control/shift key is depressed when a right click event occurs on a DataView node, if it is, the node is selected along with any others currently selected, if not- it replaces all other selections. 具体应用是查看在DataView节点上发生右键单击事件时是否按下控制/移位键,如果是,则选择该节点以及当前选择的任何其他节点,如果不是 - 它将替换所有其他选择。
Many thanks in advance for the response! 非常感谢您的回复!
You can check the event object for properties like shiftKey
, ctrlKey
, altKey
, etc. So it would be something like this (untested): 你可以检查事件对象的属性,如
shiftKey
, ctrlKey
, altKey
等。所以它会是这样的(未经测试):
myDataView.on('contextmenu', function(dv, idx, node, e){
if(e.shiftKey){
// shift is pressed
}
});
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.