Results 1 to 3 of 3

Thread: read embedded json

  1. #1
    Sencha User
    Join Date
    Sep 2011
    Posts
    33

    Default Answered: read embedded json

    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.

    Code:
    {
        "data": [
            {
                "id": "1",
                "name": "project1",
                "connection": {
                     "id": "2",
                     "name": "connection1",
                }
            }
        ],
        "total": 1,
        "success": true,
        "message": "ok"
    }
    Connection part should be indented...
    Last edited by skirtle; 2 Mar 2012 at 7:02 AM. Reason: Added CODE tags

  2. Define your model as below:
    Code:
    ...
    fields: [{
        name: 'id', type: 'string'
    },{
        name: 'name', type: 'string'
    },{
        name: 'connection', type: 'auto' 
    ...
    }]
    ...

  3. #2
    Sencha User
    Join Date
    Jan 2012
    Posts
    1,376
    Answers
    347

    Default

    Define your model as below:
    Code:
    ...
    fields: [{
        name: 'id', type: 'string'
    },{
        name: 'name', type: 'string'
    },{
        name: 'connection', type: 'auto' 
    ...
    }]
    ...

  4. #3
    Sencha User
    Join Date
    Sep 2011
    Posts
    33

    Default

    ok, thanks!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •