PDA

View Full Version : Unable to load JSON response into Store



Morescratch
27 Jan 2012, 10:36 AM
Here is my code:



Ext.regModel('Product', {
fields: [
{name: 'id', type: 'string'},
{name: 'title', type: 'string'},
{name: 'geometry', type: 'string'}
]
});

var store = new Ext.data.Store({
autoLoad: true,
model: 'Product',
proxy: {
type: 'scripttag',
url : 'http://beta.geogratis.gc.ca/api/en/nrcan-rncan/ess-sst?alt=json',
reader: {
type: 'json',
root: 'products',
totalCount: 'count'
}
}
});

Xenology
27 Jan 2012, 11:03 AM
are you gettting any errors? Or it it simply not loading?

Morescratch
27 Jan 2012, 11:14 AM
I get the raw data back but it doesn't get loaded into the model "Products"...

sealpond
30 Jan 2012, 3:51 AM
i actually have the same problem, would be fun to know what's missing :)
Nevermind i solved it by using
var store = new Ext.data.JsonStore instead of
var store = new Ext.data.Store({