|
Bett,
I've run into the same problem as you. We are working with a server-based tree and need to do dynamic updates to it. The way I resolved it was to bind the HtmlTree, get the state, and manually collapse and convert nodes to leaves as their children disappear. You can formulate the path for any node by simply starting at that node and traversing up the tree to each of its parents. (i.e. for each node, you see where it lies in the parents 'children' collection, and add it to the id string) One of the big problems with this method is that you need to make your own subclass for treenodes that knows how to manage the parent/child relationship. As it stands right now, you can't get to a parent from the children. You'll need to add that functionality yourself. (I've added an addChild(), getParent(), setParent() to my extended base class that provides this functionality) -- Jon I'm not really up-to-date with the release of 1.1.1 but I think this patch should be included ... it will save us a lot of illogical state exceptions
Thanks to Mathias Werlitz - sorry for the delay.
Even with the patch by Mathias there's on small issue left; consider this tree:
Node A contains node B, which contains node C. Then - expand node B, - delete node B, - add a new node newB to A. Node newB will have the status "expanded", as seen by the displayed icon (eg. openfolder.gif). (You can get rid of the "expanded" status, if you add a new subnode, collapse newB and delete the just now added subnode.) My workaround looks like this: After the new node is added I - get the path information of newB - from this I retrieve the parent's node path - I collapse the new node: tree.collapsePath( path ) - and expand the parent node: tree.expandPath( ppath ) This (nasty) workaround is not meant as solution but rather as a hint for someone who knows the code to get the idea what might be wrong. Best Regards, Dirk The remaining issue is due to the internal naming of tree2. Every node gets the index position in the child-array of the parent node. The node does not get a real ID, thus exchanging a node cannot be detected by the tree.
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
This should fix various invalid bitmask problems.