extjs 4 combobox,如何禁用选项卡并输入密钥 [英] extjs 4 combobox , How to disabled tab and enter key

查看:71
本文介绍了extjs 4 combobox,如何禁用选项卡并输入密钥的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用extjs 4.0.7.我想在用户使用组合框时禁用选项卡和Enter键事件.我试图使用keyUp和KeyDown事件.但是我没有得到任何提醒.

I am using extjs 4.0.7. I want to disabled tab and Enter key event when user using Combobox. I have tried to use keyUp and KeyDown event. But I didn't get any alert for it.

这是我的代码:

{
  xtype: 'combo',
  store: ds,
  id:'UserBO_SelectComponentId',
  displayField: 'displayName',
  valueField: 'userId',
  typeAhead: false,
  hideLabel: true,
  disabled: false,
  hideTrigger:true,
  multiSelect:true,
  delimiter: ";",
  anchor: '100%',
  triggerAction: 'all',
  listeners: {
     change: function( comboField, newValue, oldValue, eOpts ){
       selectUserCallBack2(newValue,'UserBO_SelectComponentId',comboField,oldValue);
     },
     select:function(comboField,oldValue){
        testRec(comboField,oldValue)
     },
     keypress:function(comboField,e){
        disabledKeysOnKeyup(comboField,e)
     }
  },
  listConfig: {
     loadingText: 'Searching...',
     enableKeyEvents: true,
     emptyText: 'No matching posts found.'
  }, 
  pageSize: 10 
}

任何人都可以在这里提出问题吗?

Can anyone please suggest what is the problem here?

推荐答案

仅当enableKeyEvents设置为true时,才会触发keyup,keydown和keypressed事件.默认情况下,此参数设置为false,因此您需要在组合框配置中添加enableKeyEvents:true.然后对Enter和Tab键进行特殊处理.

The keyup, keydown and keypressed events only fire if enableKeyEvents is set to true. Default this is set to false, so you need to add enableKeyEvents:true to the combobox config. And then do special treatment for enter and tab key.

这篇关于extjs 4 combobox,如何禁用选项卡并输入密钥的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆