我有这个组合框配置:
{
width: 70,
xtype: 'combo',
fieldLabel: _mobile,
displayField: 'num_mobile',
valueField: 'id',
id: 'ListMobileCmd',
store: mobilesStore,
triggerAction: 'all',
emptyText: 'Mobiles',
mode: 'local'
}
我的商店是:
var mobilesStore = new GeoExt.data.FeatureStore({
layer: MobileLayer,
proxy: new GeoExt.data.ProtocolProxy({
protocol: new OpenLayers.Protocol.HTTP({
url: SERVER+"/mobiles_personnes",
format: new OpenLayers.Format.GeoJSON()
})
}),
autoLoad: false,
sortInfo: { field: 'num_mobile', direction: 'ASC'},
fields: [{name: 'id', mapping: 'id'},
{name: 'num_mobile'},
{name: 'tm_id'},
{name: 'is_owner'},
{name: 'datetime_deb'},
{name: 'nom'},
{name: 's_id'},
{name: 'p_id'},
{name: 'cin'},
{name: 'login'},
{name: 'type'},
{name: 'adresse'},
{name: 'prenom'},
{name: 'num'},
{name: 'pwd'},
{name: 'datetime_fin'},
{name: 'num_mobile'},
{name: 'email'}]
});
我的所有项目都在我的组合框中,但是当我从列表中选择任何项目时,它总是显示第一项,如所选项! 有什么想法吗?
答案 0 :(得分:6)
我之前遇到过相同类型的问题:)只需将您的值字段更改为'num_mobile'即可正常工作。
valueField: 'num_mobile',