开发者

extjs Combobox typeahead / auto selection for single character

I am using extjs combobox for a sex field. It have two value "M" and "F". I want to make it usable with keyboard:

 {
     xtype: 'combo',
     typeAhead: true,
     queryMode: 'local',
     minChars: 1,
     triggerAction: 'all',
     store: [
          ['M', 'M'],
          ['F', 'F']
     ]
 }

This works if I type "Ftab" (uppercase), but not "ftab" (lowercase). If I check the code to this, the typeahead works:

 store: [
     ['M', 'Male'],
     ['F', 'Female']
 ]

Any ways to keep the value 开发者_开发知识库as "M" and have lowercase works?


not sure if you figured this one out, but I had a similar problem and found the solution:

enableKeyEvents : true,
forceSelection : true,
typeAhead : false,
    listeners : 
    {
        'keyup' : function(me)
        {
            var val = me.getRawValue();
            if(val == 'm' || val == 'f')
                me.setValue(val.toUpperCase());
        }
    }

I also had a grid that was giving me grief for a simple yes/no type selection in a combobox. I have searched high and low for an answer, but came up with this hack.

Hope it helps!


Set the combobox 'caseSensitive' config attribute to false (caseSensitive : false). This should solve problem.


You can use

listeners: {
  'specialkey': function(field, e) {
    if (e.getKey() == e.ENTER) {
      me.searchList(appMessage);
    }
  }
}

where appMessage is the message variable passed, and field the value of field to check for special case.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜