PDA

View Full Version : Loading association from JSON response.



UbuntuPenguin
3 Aug 2012, 9:35 AM
Hello Everyone,
I have service that returns JSON which I then use Ext.create( 'Someap.model.somemodel' ). I've noticed and read that the associated nested JSON however will not be turned into objects. I was wondering what the accepted way of dealing with this conundrum is. Especially in light of the fact that some of my functions may not know that the object was loaded through a store, thereby leading to the associated objects being deserialized and other objects may be loaded through a JSON service leading to the associations being serialized.

Any help is greatly appreciated.

scottmartin
3 Aug 2012, 9:45 AM
Have a look at:
http://www.sencha.com/forum/showthread.php?219981

Scott.

UbuntuPenguin
3 Aug 2012, 12:28 PM
I'm a little confused. I already have the data as an array of Objects, but I'm kind of lost as how to take this array found on the model and turn it into a bunch of Models.

I'm misunderstanding how the example you gave me does that as it loads the data through a proxy which has a url. In my case I have no url, but an array of generic objects instead.

scottmartin
3 Aug 2012, 2:08 PM
Perhaps I misunderstood your requirement. Please be aware that the writer does not support the creation of associated data and you will have to create a custom writer if using this method.

Scott.