我正在尝试在我的组合框中将我的json商店的返回值获取到setValue。此json值的值是数据库中当前选定的选项。我的this.selectedCat存储返回它所在的记录的当前类别值。我的this.store返回所有可用的选择选项。
var fields = {
fields: ['text']
};
var notfields ={
fields:['category']
}
this.store = new GO.data.JsonStore({
url: GO.settings.modules.infoscherm.url + 'json.php',
baseParams:{
task:'selects'
},
root: 'results',
fields: fields.fields
});
this.selectedCat = new GO.data.JsonStore({
url: GO.settings.modules.infoscherm.url + 'json.php',
baseParams: {
task:'currentselectedcat',
id:'id'
},
root: 'results',
fields: notfields.fields
});
this.category = new Ext.form.ComboBox({
name: 'category',
width: 100,
store: this.store,
fieldLabel: "Categorie",
displayField:'text',
triggerAction: 'all',
editable: false,
selectOnFocus:true,
value: this.selectedCat //returns [object Object] naturally
});
我做错了什么吗?
发布于 2014-06-11 19:04:00
我认为你需要开始监听"Ext.data.JsonStore“的"load”事件。附加的"load“事件处理程序将包含通过使用combobox对象的"setValue”函数选择任何特定值的代码...
附注:仅当您将combobox的" Store“配置配置为store对象时,存储值才会在combobox下拉菜单中可用,在您的情况下,您需要在"load”事件的处理程序中实现一些逻辑。
https://stackoverflow.com/questions/24143692
复制相似问题