PDA

View Full Version : Merge Multiple JSON Requests Before Passing to Store



soundsofpolaris
11 Oct 2011, 9:41 AM
Not sure if there is any way to pull this off, but here is my problem. I'm working on a mobile application that relies on several different server requests to fetch all the information I need to display. For example, I can get a list of video ids for a favorites list, but those id's need to be cross referenced with a separate request to get the thumbnail urls, descriptions, length, etc.

My plan was to was manipulate the JSON, merging all the calls into one JSON return, before passing it back Sencha via a custom proxy, but this doesn't look like it works.

Before I throw up a bunch of code, does anyone have any ideas to conceptually approach this problem?

eyepoker
11 Oct 2011, 1:12 PM
do all the work on the server, not on the device! your life will be much easier, the app will be faster, etc....

soundsofpolaris
12 Oct 2011, 7:07 AM
I would, but we can't change what the web app returns. We have to manage it on the front end...

Do you think it would be better to make a call for each model and include the redundant fields, or would it be better to look up each item in another model to get the information that is missing?

I would use a one-to-one model relationship, but they don't seem to exist, as per this thread: http://www.sencha.com/forum/showthread.php?130583-One-to-One-Association-in-Ext-4&p=658109

(http://www.sencha.com/forum/showthread.php?130583-One-to-One-Association-in-Ext-4&p=658109)So, for example. I can call the web app to get a list of available cars, including their color and model number, and I can call the web app to get a list of cars the user likes, including their model number, but I can't get the color of the car that the user likes, because that information is in the first JSON request.

I hope that makes sense.