Javascript ExtJs组合框问题
您好,我有一个带有远程combobox的formpanel,存储区是jsonstore,是从Web服务获得的,有分页结果,一切都很好,但是当您从组合中选择一个选项时,您可以选择第三个,但组合选择第一个选项我不知道原因组合的配置如下:Javascript ExtJs组合框问题,javascript,asp.net,autocomplete,combobox,extjs3,Javascript,Asp.net,Autocomplete,Combobox,Extjs3,您好,我有一个带有远程combobox的formpanel,存储区是jsonstore,是从Web服务获得的,有分页结果,一切都很好,但是当您从组合中选择一个选项时,您可以选择第三个,但组合选择第一个选项我不知道原因组合的配置如下: { xtype: 'combo', fieldLabel: 'Sitio Interés', an
{
xtype: 'combo',
fieldLabel: 'Sitio Interés',
anchor: '100%',
triggerAction: 'all',
store: dsPuntos,
mode: 'remote',
displayField: "Nombre",
valueField: "Id",
typeAhead: false,
width: 222,
hideLabel: true,
allowBlank: false,
id: 'cboDato',
editable: true,
pageSize: 20,
minChars: 0,
hideTrigger: true,
//enableKeyEvents: true,
emptyText: 'Escriba un sitio de interés',
tpl: '<tpl for="."><div class="x-combo-list-item">{Nombre} - {Municipio}</div></tpl>',
listeners: {
scope: this,
specialkey: function (f, e) {
if (e.getKey() == e.ENTER) {
Ext.getCmp('btnConsultar').handler.call(Ext.getCmp('btnConsultar').scope);
}
}
}
},
谢谢您的商店配置有点不正确。它应该是
idProperty
,而不是id
。还要检查来自服务器的json
。确保id
是唯一的
var dsPuntos = new Ext.data.JsonStore({
proxy: new Ext.data.HttpProxy({
url: 'Services/MapService.svc/GetSitiosInteres',
method: 'GET'
}),
root: 'd.rows',
totalProperty: 'd.total',
id: 'Id',
fields: ['Nombre', 'Municipio', 'Id']
});