PDA

View Full Version : loading data into combo from .json file



prasannaboga
30 Sep 2009, 4:19 AM
xtype: 'combo',
id: 'static_id',
store: new Ext.data.ArrayStore({
url: 'staticstore.json',
reader: new Ext.data.JsonReader({
fields: ['id', 'name'],
root: 'dwdata'
})
}),
displayField: 'name',
valueField: 'id'

------
staticstore.json file content

{"success":true,
"dwdata":[["1", "one"], ["2", "two"], ["3", "three"], ["4", "four"]]}
-------


dwdata array data is not loading into the combo. could anyone help me out?

jay@moduscreate.com
30 Sep 2009, 4:25 AM
I'm confused. Array store with a JSON reader?

jay@moduscreate.com
30 Sep 2009, 4:25 AM
Try this:



var data = {"success":true, "dwdata":[["1", "one"], ["2", "two"], ["3", "three"], ["4", "four"]]};
new Ext.data.ArrayStore({
url: 'staticstore.json',
root: 'dwdata',
data : data,
fields: ['id', 'name']
});