1. #1
    Sencha User
    Join Date
    Apr 2013
    Posts
    7
    Vote Rating
    0
    benomatic42 is on a distinguished road

      0  

    Default Unanswered: hasMany relationship + dynamic loading

    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

    Thanks,

    ben

  2. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    36,649
    Answers
    3454
    Vote Rating
    817
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      0  

    Default


    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 @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
    https://github.com/mitchellsimoens

    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 services@sencha.com

    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.

  3. #3
    Sencha User
    Join Date
    Apr 2013
    Posts
    7
    Vote Rating
    0
    benomatic42 is on a distinguished road

      0  

    Default


    Quote Originally Posted by mitchellsimoens View Post
    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.
    What magic words do I need to incant to not load it all up front? Or put another way, do you know of a good example of this someplace?

    b

Thread Participants: 1

Tags for this Thread