Extjs 组合框-下拉列表中的自动位置
我有一个简单的组合框,如下所示:Extjs 组合框-下拉列表中的自动位置,extjs,extjs4,Extjs,Extjs4,我有一个简单的组合框,如下所示: { xtype: 'combobox', id: 'prd-main-group', fieldLabel: 'ANA MAL GRUBU', inputWidth: 320, labelWidth: 160,
{
xtype: 'combobox',
id: 'prd-main-group',
fieldLabel: 'ANA MAL GRUBU',
inputWidth: 320,
labelWidth: 160,
labelAlign: 'right',
margin: '15 0 0 0',
fieldStyle: 'height: 26px; text-align: right; font-size: 12pt; color:#505050',
store: articleMain,
valueField: 'WHG',
displayField: 'WHG_BEZ',
queryMode: 'remote',
autoSelect: false,
selectOnFocus: true,
hideTrigger: true,
msgTarget: 'side',
triggerAction: 'all',
typeAhead: true,
minChars: 2,
listeners: {
select: function (combo, selection) {
articleBase.proxy.extraParams = {'maingroup': combo.getValue()};
Ext.getCmp('prd-base-group').setDisabled(false);
Ext.getCmp('prd-base-group').getStore().removeAll();
Ext.getCmp('prd-base-group').setValue(null);
Ext.getCmp('prd-sub-group').getStore().removeAll();
Ext.getCmp('prd-sub-group').setValue(null);
articleBase.load();
},
focus: function(combo) {
combo.setValue('');
}
}
},
当我输入两个或更多字符时,会出现组合框下拉列表,并显示值,但不会自动从下拉列表中定位所选记录
正如您所看到的附加屏幕截图,值已完成,但下拉列表未聚焦所选记录
我的问题是,当我们键入几个字符时,下拉列表应该根据给定的字符自动更改。您应该尝试使用
autoSelect:true
如果没有Kirtle's Den,我该怎么办:)
我们应该在store
定义中设置autoLoad:true
参数。之后,我们还应该将queryMode
设置为local
。我知道这毫无意义,但当我们设置自动加载时,数据会在创建存储时立即加载
{
xtype: 'combobox',
id: 'prd-main-group',
fieldLabel: 'ANA MAL GRUBU',
inputWidth: 320,
labelWidth: 160,
labelAlign: 'right',
margin: '15 0 0 0',
fieldStyle: 'height: 26px; text-align: right; font-size: 12pt; color:#505050',
store: articleMain,
valueField: 'WHG',
displayField: 'WHG_BEZ',
queryMode: 'local',
autoSelect: true,
forceSelection: true,
msgTarget: 'side',
triggerAction: 'all',
listeners: {
select: function (combo, selection) {
articleBase.proxy.extraParams = {'maingroup': combo.getValue()};
Ext.getCmp('prd-base-group').setDisabled(false);
Ext.getCmp('prd-base-group').getStore().removeAll();
Ext.getCmp('prd-base-group').setValue(null);
Ext.getCmp('prd-sub-group').getStore().removeAll();
Ext.getCmp('prd-sub-group').setValue(null);
articleBase.load();
},
focus: function(combo) {
combo.setValue('');
}
}
}
以下是商店的定义:
var articleMain = new Ext.data.JsonStore({
model: 'ArticleMainGroup',
autoLoad: true,
proxy: {
type: 'ajax',
url: '<?php echo base_url() ?>create/get_product_main_group',
reader: {
type: 'json',
root: 'articleMainGroup',
idProperty: 'ID'
}
}
});
var articleMain=new Ext.data.JsonStore({
模型:“ArticleMainGroup”,
自动加载:对,
代理:{
键入:“ajax”,
url:“创建/获取产品主组”,
读者:{
键入:“json”,
root:'articleMainGroup',
idProperty:“ID”
}
}
});
ForceSelection=“true”
+TypeAhead=“true”
它应该可以工作