【发布时间】:2012-10-08 14:31:09
【问题描述】:
我需要将 db 值加载到组合框。我不知道为什么值没有加载到组合框中。通过 firebug,console.log 值被打印出来。这是我的组合框代码,
var groups = new Ext.data.JsonStore({
fields: [{
id: 'id'
}, {
name: 'name'
}],
root: 'rows',
autoDestroy: true,
autoLoad: true,
proxy: new Ext.data.HttpProxy({
url: GO.settings.modules.schedule.url + 'groups.php',
}),
reader: {
type: 'json',
root: 'rows'
},
listeners: {
load: function (obj, records) {
Ext.each(records, function (rec) {
console.log(rec.get('name'));
});
}
}
});
var taskGroup = new Ext.form.ComboBox({
name: 'Group',
hiddenName: 'group',
triggerAction: 'all',
editable: false,
fieldLabel: 'Group',
mode: 'local',
autoLoad: true,
displayField: 'text',
store: groups,
columns: [{
dataIndex: 'name'
}],
});
【问题讨论】:
-
我从那个 URL {'rows': [{ 'id': '1', 'name': 'Google', }, { 'id': '2', 'name ': 'Microsoft', }, { 'id': '3', 'name': 'Yahoo', }]}