DIfferent models for TreeNodes (Nested data associations)
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.
Tags for this Thread