1. #1
    Sencha Premium Member twasink's Avatar
    Join Date
    Oct 2012
    Location
    Brisbane, Australia
    Posts
    100
    Vote Rating
    9
    twasink will become famous soon enough

      0  

    Default Model associations via associative arrays/maps/hashes

    Model associations via associative arrays/maps/hashes


    Sometimes, when working with JSON data, you don't get the format you want. In particular, it's not uncommon to see nested JSON data expressed as an object, instead of arrays. For example:

    Code:
    [
      { "id": "foo_1", "baz": "baz_1", "bux": "bux_1", "bar": {
          "bar_1": { "baz": "bar_baz_1", "bux": "bar_bux_1" },
          "bar_2": { "baz": "bar_baz_2", "bux": "bar_bux_2" }
        }
      },
      { "id": "foo_2", "baz": "baz_2", "bux": "bux_2", "bar": {
          "bar_1": { "baz": "bar_baz_3", "bux": "bar_bux_3" },
          "bar_2": { "baz": "bar_baz_4", "bux": "bar_bux_4" }
        }
      }
    ]
    ExtJS models can't read this out of the box. But it's possible to add a custom reader to your associations which can.

    See this Gist: https://gist.github.com/twasink/5392441
    or my blog post: http://twasink.net/2013/04/16/readin...-extjs-models/

  2. #2
    Sencha - Support Team slemmon's Avatar
    Join Date
    Mar 2009
    Location
    Boise, ID
    Posts
    5,459
    Vote Rating
    202
    slemmon has much to be proud of slemmon has much to be proud of slemmon has much to be proud of slemmon has much to be proud of slemmon has much to be proud of slemmon has much to be proud of slemmon has much to be proud of slemmon has much to be proud of

      0  

    Default


    Thanks for sharing!

Thread Participants: 1

Tags for this Thread