Extjs 组合框中的默认值作为存储区中的值
我试图将json存储的返回值转换为combobox中的setValue。此json值的值是数据库中当前选定的选项。My this.selectedCat store返回其所在记录的当前类别值。my this.store返回所有可用的选择选项Extjs 组合框中的默认值作为存储区中的值,extjs,extjs3,Extjs,Extjs3,我试图将json存储的返回值转换为combobox中的setValue。此json值的值是数据库中当前选定的选项。My this.selectedCat store返回其所在记录的当前类别值。my this.store返回所有可用的选择选项 var fields = { fields: ['text'] }; var notfields ={ fields:['category'] } this.store = new GO.data.JsonStore({ url: GO.s
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
});
我做错什么了吗?我认为您需要开始监听“Ext.data.JsonStore”的“load”事件。 “load”事件的附加处理程序将包含使用combobox对象的“setValue”函数选择任何特定值的代码 注意:只有将combobox的“Store”配置配置为Store对象时,combobox下拉菜单中的Store值才可用。在您的情况下,您需要在“load”事件的处理程序中实现一些逻辑