在 EXTJS 中对相同的选择器使用不同的事件
Use different events for same selector in EXTJS
在网格上,我需要监听 itemclick 和 itemkeydown 动作,但是当我将它们都添加到我的控制器中时,它们中的 none 会被触发。这段代码有什么问题?
如何在网格的组合框编辑器上监听按键事件?
'definitiontypeform dtpropertylist': {
itemclick: this.doSelectPropertyGrid
},
'definitiontypeform dtpropertylist': {
itemkeydown: this.doAddInitial
},
尝试以下方法
'definitiontypeform dtpropertylist': {
itemclick: this.doSelectPropertyGrid,
itemkeydown: this.doAddInitial
},
您可以在同一选择器中添加多个要收听的事件。
在您的代码中,您向控件对象添加了两次相同的键 'definitiontypeform dtpropertylist'
,这会导致意外行为。
关于 fiddle
中的问题
I can't listen to the keypress here. I have a jsfiddle example for that. how can I listen to keyboard on combobox editor in a grid?
为您感兴趣的事件添加一个监听器到编辑器配置,例如
listeners: {
keydown: function(){
// your code ...
}
}
并且不要忘记为组合框启用 Keyevents 。
enableKeyEvents: true
完整代码应该是
editor: {
...
enableKeyEvents: true,
listeners: {
keydown: function(){
// your code ...
}
}
},
在网格上,我需要监听 itemclick 和 itemkeydown 动作,但是当我将它们都添加到我的控制器中时,它们中的 none 会被触发。这段代码有什么问题?
如何在网格的组合框编辑器上监听按键事件?
'definitiontypeform dtpropertylist': {
itemclick: this.doSelectPropertyGrid
},
'definitiontypeform dtpropertylist': {
itemkeydown: this.doAddInitial
},
尝试以下方法
'definitiontypeform dtpropertylist': {
itemclick: this.doSelectPropertyGrid,
itemkeydown: this.doAddInitial
},
您可以在同一选择器中添加多个要收听的事件。
在您的代码中,您向控件对象添加了两次相同的键 'definitiontypeform dtpropertylist'
,这会导致意外行为。
关于 fiddle
中的问题I can't listen to the keypress here. I have a jsfiddle example for that. how can I listen to keyboard on combobox editor in a grid?
为您感兴趣的事件添加一个监听器到编辑器配置,例如
listeners: {
keydown: function(){
// your code ...
}
}
并且不要忘记为组合框启用 Keyevents 。
enableKeyEvents: true
完整代码应该是
editor: {
...
enableKeyEvents: true,
listeners: {
keydown: function(){
// your code ...
}
}
},