Events 禁用extjs 3.4组合中的输入键事件

Events 禁用extjs 3.4组合中的输入键事件,events,extjs,combobox,enter,Events,Extjs,Combobox,Enter,我使用的是ExtJS3.4。我需要为组合禁用ENTER键事件。我尝试了以下代码,但没有成功。请帮忙 var combo = new Ext.form.comboBox({ id: 'id', enableKeyEvents: true, store: store, triggerAction: 'all', listeners: { keydown: function(combo, e) { var key = e.getKey(); if (key

我使用的是ExtJS3.4。我需要为组合禁用ENTER键事件。我尝试了以下代码,但没有成功。请帮忙

var combo = new Ext.form.comboBox({
  id: 'id',
  enableKeyEvents: true,
  store: store,
  triggerAction: 'all',
  listeners: {
   keydown: function(combo, e) {
     var key = e.getKey();
     if (key == e.ENTER) {
       e.stopEvent();
     }
   }
  }
});

上述方法不起作用。仍然为combo输入事件工作。请帮助。

您好,您只需使用以下命令即可

var combo = new Ext.form.comboBox({
  id: 'id',
  enableKeyEvents: true,
  store: store,
  triggerAction: 'all',
  listeners: {
   keydown: function(combo, e) {
     var key = e.getKey();
     if (key == e.ENTER) {
       e.stopEvent();
     }
   }
  }
});
     onkeypress="if(event.keyCode==13){return false;}"

查看ext-all-debug.js,您应该能够在创建组合框后覆盖keyNav的enter处理程序:

listeners: {
  render: function() {
    this.keyNav.enter = function() { ... };
  }
}