12 May 2013 8:03 AM #1
Unanswered: hasMany relationship + dynamic loading
I've been fruitlessly searching for something that feels like it should be ... uncomplicated. So far everything I've found in examples/docs suggests that store proxies want to load all data, and filter out what is stored, as opposed to dynamically loading based on what is needed. (Note: the data source is RESTful JSON, and not controlled by me -- meaning that I can't change it to suit my needs.)
Quick data summary of data relationships:
1 Tournament :: Many TournamentTeams
1 TournamentTeam :: 1 Team
1 Team :: Many Players
At startup I know my tournament IDs (this app manages 3, and they are static). I want to dynamically load TournamentTeams and Teams from there -- but I cannot load the whole db of them -- there are way too many. Simultaneously, I need to run a single query to convert a login token into a player_id.
After those 2 steps are complete, I can figure out which Team contains the player_id in question. Then I want to load all the Players with the same team_id.
Then after this, I will use the same routine with Games, Scores, etc., etc.
Can somebody point me to a good doc/tutorial + example for this kind of behavior?
I am happy to post models, etc., if they're useful, but this message is already verbose
14 May 2013 5:39 AM #2
- Join Date
- Mar 2007
- Gainesville, FL
- Vote Rating
Associations don't have to have all data loaded up front. Once you execute the getter then the request is made for the associated data, you just need to have a proxy defined on the associated model.Mitchell Simoens @LikelyMitch
Sencha Inc, Senior Software Engineer
Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
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 firstname.lastname@example.org
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.
14 May 2013 1:42 PM #3