ComboBox初始化第一次加载的时候显示的是key值,点击一次之后以后才显示的是value值,开始是加载的时候给它手工赋值,但提交的时候会提交value值而不是key值
解决方法:
store: new Ext.data.Store({
proxy: new Ext.data.HttpProxy({
url:"",
method: "",
headers: {
accept: "application/xml"
}
}),
reader: new Ext.data.XmlReader({
totalRecords: "total",
record: "item"
},[{
name: "key",
name: "value"
}]),
autoLoad: true
});
new Ext.form.ComboBox({
fieldLabel: "测试",
name: "test",
hiddenName: "name",
vlaueField: "key",
dispalyField: "value",
// mode: "remote",
store: store,
typeAhead: true,
forceSelection: true,
triggerAction: "all",
selectOnFocus: true
});
本文介绍了一个ComboBox组件在初始化时显示key而非value的问题,并提供了解决方案。通过设置store及ComboBox的相关配置,确保ComboBox首次加载即显示value,同时提交时正确传递key值。
5536

被折叠的 条评论
为什么被折叠?



