Results 1 to 3 of 3

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

  1. #1
    Sencha User
    Join Date
    Nov 2010
    Posts
    439
    Vote Rating
    7
      0  

    Default 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
    454
    Vote Rating
    22
      0  

    Default 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 - Sr Software Engineer mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    39,551
    Vote Rating
    1271
      0  

    Default

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

    This worked for me:

    Mitchell Simoens @LikelyMitch
    Sencha Inc, Senior Software Engineer
    ________________
    Learn BBCode and use it! Checkout the CODE tag!

    Check out my GitHub, lots of nice things for Ext JS and Sencha Touch
    https://github.com/mitchellsimoens

Tags for this Thread

Posting Permissions

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