Extjs Combobox typeahead / auto select for single character

I am using extjs combobox for the sexual field. It has two meanings "M" and "F". I want to make it suitable for use with a keyboard:

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

This works if I type "F tab " (upper case), but not "f tab " (lowercase). If I check the code for this, typeahead will work:

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

Is it possible to save the value as "M" and work with lower case?

+8
extjs extjs4 combobox
source share
3 answers

Not sure if you understood this, but I had a similar problem and found a 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 gave me sadness for a simple yes / no choice in the drop-down list. I searched high and low for an answer, but came up with this hack.

Hope this helps!

+3
source share

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

+3
source share

you can use

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

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

-one
source share

All Articles