1. #1
    Sencha User
    Join Date
    Nov 2010
    Posts
    407
    Vote Rating
    6
    gkatz is on a distinguished road

      0  

    Default using nested json to populate a list without associations...

    using nested json to populate a list without associations...


    hi;
    I need to populate a store/model with nested json but I don't want to use associations. is this possible?
    for example, the following json:
    Code:
    {  
       "cnt":2,
       "list":[  
          {  
             "sys":{  
                "type":1,
                "sunset":1415630635
             },
              .....
          },
          {  
             "sys":{  
                "type":1,
                "sunset":1415634563
             },
              .....
          }
    ...
    I want to use a template and populate my model with something like:
    Code:
    { name: 'sset', type: 'string', mapping: 'sys.sunset' },
    and point my proxy reader to :
    Code:
    root: 'list'
    thus ignoring the association that each item in this list has a single 'sys' object.
    can I achieve this somehow? the mappings thing does not seem to work for me. I found if on the net but not in the docs. you help is appreciated!.
    thanks!

  2. #2
    Sencha User
    Join Date
    Aug 2011
    Location
    London
    Posts
    409
    Vote Rating
    18
    digeridoopoo will become famous soon enough

      0  

    Default Does this post help?

    Does this post help?


    I've not used associations before so not sure if I can help. I did have a similar issue accessing data inside the array part of the response, so not sure if this post will help you or not:

    http://www.sencha.com/forum/showthre...-a-Nested-List

    :-)

  3. #3
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    37,642
    Vote Rating
    899
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      0  

    Default


    @gkatz, you are very close to getting it. Instead of "root" on your reader, try "rootProperty".

    This worked for me:

    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
    https://github.com/mitchellsimoens

    Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/

    Need more help with your app? Hire Sencha Services services@sencha.com

    Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is in print!

    When posting code, please use BBCode's CODE tags.

Thread Participants: 2

Tags for this Thread