Results 1 to 4 of 4

Thread: DIfferent models for TreeNodes (Nested data associations)

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Sencha User
    Join Date
    May 2009
    Posts
    144
    Vote Rating
    14
      0  

    Default 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 - Sr Software Engineer mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    39,556
    Answers
    3931
    Vote Rating
    1272
      0  

    Default

    The TreeStore will only be able to use 1 model.
    Mitchell Simoens @LikelyMitch
    Sencha Inc, Senior Software Engineer
    ________________
    Learn BBCode and use it! Checkout the CODE tag!

    Check out my GitHub, lots of nice things for Ext JS and Sencha Touch
    https://github.com/mitchellsimoens

  3. #3
    Sencha User
    Join Date
    May 2009
    Posts
    144
    Vote Rating
    14
      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 - Sr Software Engineer mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    39,556
    Answers
    3931
    Vote Rating
    1272
      0  

    Default

    Probably out of scope for Ext JS 4.x
    Mitchell Simoens @LikelyMitch
    Sencha Inc, Senior Software Engineer
    ________________
    Learn BBCode and use it! Checkout the CODE tag!

    Check out my GitHub, lots of nice things for Ext JS and Sencha Touch
    https://github.com/mitchellsimoens

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •