PDA

View Full Version : Data Store Load Issue



voloflip
19 Aug 2011, 9:02 AM
I have the following problem, when I populate my Store via AJAX call to the page that returns JSON, it gets populated with empty records. For example in Firebug for Ext.util.MixedCollection I see 108 records; all empty. Should be just one. Code example:

Ext.regModel('Stuff', {
fields: ['sfirstName', 'slastName', 'playNumber', 'sEmail', 'sPhone']
});

Stuff = new Ext.data.Store({
model: 'Stuff',
proxy: {
type: 'ajax',
url: '/Stuff',
reader:
{
type: 'json',
root: 'records'
}
}
});

JSON response: {"records":"[{\"sfirstName1\":\"John\",\"slastName1\":\"UserName1\",\"sEmail1\":\"[email protected]\",\"sPhone1\":\"(248) 232 2322\"}]"}

Any ideas? THX!

sissonb
19 Aug 2011, 1:35 PM
Looks like the server is escaping the quotes in the JSON when it shouldn't.

Paste that JSON into http://jsonviewer.stack.hu/ and then go to the viewer tab to see the structure issue.