PDA

View Full Version : jsonReader problem



Raidri
24 Feb 2010, 6:32 AM
Hey guys,

I've some problems with the jsonReader. I got this error from firebug:

missing ) in parenthetical
chrome://firebug/content/blank.gif({"total":"1","results":[{"firstname":...n appropriate View was not found. -->)

and that is the response from the Server:

{"total":"1","results":{"firstname":"abc","lastname":"def","email":"[email protected]","address":"","zip":"","city":"","country":"dd","telephone":""}}


and that is my jsonReader:


success: function(response) {
var jsonReader = new Ext.data.JsonReader({
totalProperty: \'total\',
root: \'results\',
fields: [
{name: \'firstname\', mapping: \'firstname\'},
{name: \'lastname\', mapping: \'lastname\'},
{name: \'email\', mapping: \'email\'},
{name: \'address\', mapping: \'address\'},
{name: \'zip\', mapping: \'zip\'},
{name: \'city\', mapping: \'city\'},
{name: \'country\', mapping: \'country\'},
{name: \'telephone\', mapping: \'telephone\'}
]
});
jsonReader.read(response);
}


I dont know what's wrong there. Hope you can find the error.

Thanks a lot.

Greetings Raidri

24 Feb 2010, 4:31 PM
results needs to be an array of objects, not an object.

Raidri
25 Feb 2010, 1:22 AM
Ok, if i understood you right, i need a response like this.

{"total":"1","results":[{"firstname":"abc","lastname":"abc","email":"[email protected]","address":"","zip":"","city":"","country":"DE","telephone":""}]}

But i get the same error. :-/