PDA

View Full Version : ComboBox is not showing remote data



Bytecode
10 Apr 2010, 2:36 AM
Hi,

I have a combo box that works with local data but is not displaying the JSON data returned from the server.

The JSON data returned from the server is:



{"projects":[
{"class":"org.acme.Project","id":1,"title":"P 1"},
{"class":"org.acme.Project","id":2,"title":"P 2"}]}


The dataStore definition is:



projectStore = new Ext.data.Store({
reader: new Ext.data.JsonReader({
root: 'projects',
fields: ['id', 'title']
}),
proxy: new Ext.data.HttpProxy({
url: 'projects.jsp'
})
});


And the combo box is defined inside a viewport as:



xtype: 'combo',
fieldLabel: 'Projects',
name: 'project',
store: projectStore,
displayField: 'title',
valueField: 'id',
mode: 'remote'


Using Firebug, I can see that the projectStore is loaded correctly as the data.items field contains two objects with id and title fields.

Any ideas what's wrong with this code?