PDA

View Full Version : Form load question [Resolved]



Mango_lier
15 Mar 2010, 4:27 PM
Just a silly question.

I have a JSON reader configured in a FormPanel like below


reader: new Ext.data.JsonReader({
root: 'data',
totalProperty: 'totalrecords',
id: 'ID'
},
[ 'Name', 'Address', 'City', 'UserLevel', 'Birthdate', 'CanPost', 'Login', 'Password', 'Rating', 'Comments']),
items: [ Name, Address, City, UserLevel, Birthdate, CanPost, Login, Password, Rating, Comments]


And the returned JSON looks like this

{
"success": true,
"pagesize": 1,
"page": 1,
"totalrecords": 1,
"data": {
"Name": "My Name",
"Address": "Main Street",
"City": "3",
"UserLevel": "1",
"Birthdate": "12\u002F3\u002F2007",
"CanPost": "No",
"Login": "test",
"Password": "test",
"Comments": "First record"
}
}

But somehow the extractData() function cannot extract the record. The firebug indicate that "root.length" in the extractData() function is undefined. Any ideas?


---------
Figured out the reason, the returned JSON should have the "ID" included as configured in the JsonReader.

Mango_lier
16 Mar 2010, 10:51 AM
Polite bump