PDA

View Full Version : read embedded json



ultra2
2 Mar 2012, 2:04 AM
How to load this json in Extjs? I created two model's with appropriate fields. A BelongsTo association didn't help me, because it seems to be for only reference- not embedded association.


{
"data": [
{
"id": "1",
"name": "project1",
"connection": {
"id": "2",
"name": "connection1",
}
}
],
"total": 1,
"success": true,
"message": "ok"
}

Connection part should be indented...

vietits
2 Mar 2012, 4:40 AM
Define your model as below:


...
fields: [{
name: 'id', type: 'string'
},{
name: 'name', type: 'string'
},{
name: 'connection', type: 'auto'
...
}]
...

ultra2
3 Mar 2012, 1:48 PM
ok, thanks!