PDA

View Full Version : Urgent Help on Loading DB values to Json store



rxbass
17 Oct 2012, 11:21 PM
I need to load db values to a combo box for multi selection. I can't figure out, why values are not loading into combo box. By firebug, console.log values are printed out. Here is my code for multiselect combo box,


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'
}
],
});

metalinspired
18 Oct 2012, 7:21 AM
Sample of your data would be helpful, but try this:
var taskGroup = new Ext.form.ComboBox({
name : 'Group',
hiddenName : 'group',
triggerAction : 'all',
editable : false,
fieldLabel : 'Group',
mode : 'local',
autoLoad: true,
displayField : 'name',
store : groups,
],
});