1. #1
    Sencha User
    Join Date
    May 2009
    Posts
    135
    Vote Rating
    1
    DiscoBoy is on a distinguished road

      0  

    Default Unanswered: DIfferent models for TreeNodes (Nested data associations)

    Unanswered: DIfferent models for TreeNodes (Nested data associations)


    Hello,

    after already tweaked my code a lot to get this working I noticed a new behavior in this issue with 4.1. I want to achieve a Tree, where the root of the TreeStore is of the model "MAP". All subsequent children nodes should be of the type "LAYER". Of course I have configured the TreeStore with one model, the model "MAP" and the MAP/LAYER models are associated (hasMany/belongsTo)

    When I want to load new maps, I set a new RootNode (JSON object). NOW COMES THE PROBLEM: All the nested data is interpreted as MAP models. I have no clue how I could set a modell/class type on my children node so they become LAYERs. This was the behavior in Ext 4.0 and party in 4.1...
    My solution was a decorate function, copying my LAYER properties & methods to each child node (similar to the NodeInterface decoration)

    What changed in 4.1 is that when I later dynamically add a new node (for instance by dragging a LAYER model on the tree), the new node SUDDENLY KEEPS its model type (in most cases)

    This is all very awkward and working with trees seems to be a total mess in ExtJS 4.X so far. But of course it could also be that I simply missed a config which would turn all my nested children in the desired model...

    Help ver much appreciated!!!

    Thanks a lot.

  2. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    37,330
    Answers
    3541
    Vote Rating
    847
    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


    The TreeStore will only be able to use 1 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
    May 2009
    Posts
    135
    Vote Rating
    1
    DiscoBoy is on a distinguished road

      0  

    Default


    The strage thing is then, that since 4.1 sometimes I have different models in the tree when inserting nodes later (Drag &Drop, etc). Is it planned to have more models and make use of model relationships in the future?

  4. #4
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    37,330
    Answers
    3541
    Vote Rating
    847
    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


    Probably out of scope for Ext JS 4.x
    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.