我需要在自动获得焦点后打开一个组合菜单。更改minchar
配置无效。为此目的还有其他配置吗?
更新
Ext.define("My.form.combo.Local", {
extend: "Ext.form.ComboBox",
xtype: 'local-combo',
queryMode: 'local',
minChars: 0,
selectOnFocus: true,
forceSelection: true,
typeAhead: true,
initComponent: function () {
this.callParent();
this.on('focus', function () {
console.log('f');
this.expand();
});
}
});
答案 0 :(得分:2)
以下剪辑在ExtJS 4.2.3中起作用
来控制选择器// The data store containing the list of states
var states = Ext.create('Ext.data.Store', {
fields: ['abbr', 'name'],
data : [
{"abbr":"AL", "name":"Alabama"},
{"abbr":"AK", "name":"Alaska"},
{"abbr":"AZ", "name":"Arizona"}
//...
]
});
// Create the combo box, attached to the states data store
var c =Ext.create('Ext.form.ComboBox', {
fieldLabel: 'Choose State',
store: states,
queryMode: 'local',
displayField: 'name',
valueField: 'abbr',
renderTo: Ext.getBody()
});
c.on('focus',function(c){c.expand()})
答案 1 :(得分:-1)
我为你做了一个小提琴:https://fiddle.sencha.com/#fiddle/fj5
它就像一个魅力。也许你的代码中还有其他一些问题。