1. #1
    Sencha User
    Join Date
    Mar 2011
    Location
    Norway
    Posts
    5
    Vote Rating
    0
    Mithon is on a distinguished road

      0  

    Default Model: Lazy loading associated models

    Model: Lazy loading associated models


    Assuming the User->Posts->Comments Model structure described in the Ext.data.Model API entry, I'm wondering how I should fit the pieces together so that my User-store loads no associated models untill one gets selected.

    Basically, I want a grid of Users, and a view of Posts and Comments for the selected User, but I don't want to load all the Posts and Comments for all Users in the view.

    I'm assuming when I load a User, it will automatically load its associated Posts and Comments from their configured proxies, or can I control when that happens somehow? I see the autoLoad/autoSave config options, but they don't seem to be what I need.

    How does that fit with a Users proxy that loads not only users, but Posts and Comments as well? Could I have my users proxy return an empty set of Posts and Comments, so that the Model think it's been fully loaded, and then manually trigger loading Posts and Comments from their proxies when selecting a User?

    Would the best solution be to not associate the models in this scenario, and manage the stores programatically, or is there an intended way to configure this sort of thing?

    I don't want to autosave anything. But I would like a change to a post, to effectuate marking the User as dirty. (Due to my actual entities consisting of concepts other than users and posts.) That is I would like to select a User, edit/add a post, and then save the User (with his/her posts).

    As you can see I'm rather confused on the subject, and any help to clear up how this is intended would be greatly appreciated.

    Thanks in advance,
    - Mithon

  2. #2
    Sencha User
    Join Date
    Mar 2011
    Location
    Norway
    Posts
    5
    Vote Rating
    0
    Mithon is on a distinguished road

      0  

    Default


    So, I'm wondering if this is getting no replies due to the post length, the question being irrelevant to most people, the topic has allready been answered elsewhere and I should have looked there before posting, no reader has yet had any usefull information to share on the topic, or some other reason?

  3. #3
    Ext JS Premium Member westy's Avatar
    Join Date
    Feb 2009
    Location
    Bath, UK
    Posts
    894
    Vote Rating
    39
    westy is a jewel in the rough westy is a jewel in the rough westy is a jewel in the rough

      0  

    Default


    Heh, sometimes things just don't get answered; I know a few of my posts have been read, but no-one felt like chipping in with any thoughts or a solution

    It's an interesting question, since it sounds like a potential solution for how you could build a complex tree store, something which I'm going to attempt shortly...

    I can only assume that the association stuff built in to models must allow for what you are asking for.
    I can't believe it's only used for consuming a JSON object during a read...

    I'll try and have a look into it soon since this sounds like a nice way of approaching a complex tree.
    Another thought I had was inheriting from Store and trying to kinda glue several stores together, swapping the tree store depending on your context.

    The lack of complex examples for models, stores and trees is a tad frustrating I feel.

  4. #4
    Sencha User
    Join Date
    Mar 2011
    Location
    Norway
    Posts
    5
    Vote Rating
    0
    Mithon is on a distinguished road

      0  

    Default


    Quote Originally Posted by westy View Post
    The lack of complex examples for models, stores and trees is a tad frustrating I feel.
    Indeed. Right now I'm just hoping this will get fleshed out some more by the time it's released, though I guess it's allready released since it's part of Sencha Touch.

    To my way of thinking a web application framework isn't complete untill I can have associated entities, and I'm able to populate a master grid, and bind a details form for the models fields, including a child grid for associated models. Furthermore you should have control over when what is loaded, so that you don't have to load more data than you need, which is the topic of my OP. Finally you should be able to configure wether to save the hierarchy on a user action, or automatically with every change.

    How these requirements are met by the Ext data framework is rather unclear to me at the moment though. In fact I think answering such questions would benefit a lot of programmers.

Similar Threads

  1. Model.load not sending id, loading all models
    By dewie in forum Sencha Touch 1.x: Discussion
    Replies: 26
    Last Post: 8 Jul 2014, 1:45 PM
  2. Loading Multiple Models by Association using Store
    By babar.sajjad in forum Sencha Touch 1.x: Discussion
    Replies: 3
    Last Post: 31 Mar 2011, 6:56 AM
  3. Lazy loading of GXT modules
    By michalk in forum Ext GWT: Discussion
    Replies: 3
    Last Post: 13 Oct 2009, 1:12 AM
  4. Lazy Loading
    By Algiano in forum Ext GWT: Discussion
    Replies: 1
    Last Post: 30 Jul 2009, 2:11 PM
  5. lazy tab loading not working
    By phwaap in forum Ext 2.x: Help & Discussion
    Replies: 4
    Last Post: 2 Jun 2008, 4:57 PM

Thread Participants: 1

Turkiyenin en sevilen filmlerinin yer aldigi xnxx internet sitemiz olan ve porn sex tarzi bir site olan mobil porno izle sitemiz gercekten dillere destan bir durumda herkesin sevdigi bir site olarak tarihe gececege benziyor. Sitenin en belirgin ozelliklerinden birisi de Turkiyede gercekten kaliteli ve muntazam, duzenli porno izle siteleri olmamasidir. Bu yuzden iste. Ayrica en net goruntu kalitesine sahip adresinde yayinlanmaktadir. Mesela diğer sitelerimizden bahsedecek olursak, en iyi hd porno video arşivine sahip bir siteyiz. "The Best anal porn videos and slut anus, big asses movies set..." hd porno faketaxi