Due to the impact related to this issue, we have to defer this issue to the next major or minor release.
  1. #1
    Sencha User
    Join Date
    Feb 2012
    Posts
    3
    Vote Rating
    2
    vstulski is on a distinguished road

      0  

    Default Associations and WebStorage

    Associations and WebStorage


    After few experiments with simple one-to-many parent-child associations (using hasMany and belongsTo) I concluded that they don't work (at least with local storage).

    Problem #1 is even if I am able to have perfectly fine database structure in the local storage (parent_id field on a child is filled with the right value pointing to id of the parent table) the subsequent reads from the local storage always load all child entities regardless of whether they belong to a parent or not. It seems like Ext.data.Store simply ambushes parent_id with the modelDefaults right after read.

    Problem #2 arises if I create phantom Parent, assign a bunch of phantom Child entities to it and then try to sync them all to a storage. While perfect in memory after creation (phantom Child entities are accessible from the Parent through generated accessor method), the structure preserved in the local storage has parent_id on a Child entities set to null.

    I tried to fix the id/parent_id through a bunch workarounds, but the only solution I found is to manage connected entities bypassing associations. I love the concept of the associations and understand the complexity behind it, though unfortunately can't use them.

  2. #2
    Sencha User
    Join Date
    Oct 2011
    Location
    Germany
    Posts
    146
    Vote Rating
    10
    Möhre will become famous soon enough

      0  

    Default


    Localstorage has still a lot of problems in 2.0.

    Simply search "localstorage" in this bug-forum...

    http://www.sencha.com/forum/showthread.php?173327-WebStorage-proxy-can-t-deal-with-associated-data

  3. #3
    Sencha User
    Join Date
    Feb 2012
    Posts
    3
    Vote Rating
    2
    vstulski is on a distinguished road

      0  

    Default


    Thanks for the pointer!

  4. #4
    Sencha User
    Join Date
    Mar 2007
    Location
    Haarlem, Netherlands
    Posts
    1,243
    Vote Rating
    9
    TommyMaintz will become famous soon enough TommyMaintz will become famous soon enough

      0  

    Default


    Like Mohre said, unfortunately associations in combination with local storage has not been implemented. We are planning some big improvements to associations and local storage for 2.1. In the meantime you could look to implement a custom solution by overriding the WebStorage proxy.

    Sorry for this missing functionality currently.

    Best,
    Tommy

Thread Participants: 2