JavaScript.CoolDev.Com Support Forums
Any questions related to JavaScript menu and JavaScript tree menu by Javascript.CoolDev.Com
| Author |
Message |
alexvanniel
Joined: 20 Feb 2008 Posts: 2
|
Posted: Wed Feb 20, 2008 8:26 am Post subject: Dynamic tree updating |
|
|
Hi there,
I have been trying to dynamically update a COOLjsTreePro object but a couple of problems seem to arise.
For one, when I use the recreate() method, and I have a menu definition like [["test",null,null],["test2",null,null],["test3",null,null,["test4",null,null]]] then either nothing seems to get updated, or I get an error, or only test3 with test4 as child is shown.
Now, adding Nodes with addNode() seems to work fine, but when I for instance do a getRoot() on the main object, and then deleteNode(0) for instance, sometimes the first node IS deleted, sometimes it results in an error.
But I need to be able to sort of throw away the old tree, declare new nodes and display that tree.
What I now do is recreate with a dummy node defenition ["",null,null] and then I add my nodes with addNode()
This works fine, until you take a look at the root, after a few nodes have been replaced the root tree is getting filled with nodes and after each click it gets worst and worst. I am afraid that after a while the number of nodes is getting so big that the browser will collapse.... ANY ideas on this?
Any help would be appreciated but as far as I can see now, recreate seems to have some bugs and deleteNode seems to have some issues as well. Also, doing a nodeByIndex() on an index that doesn't exist causes a node of that index to be added to the root node... |
|
| Back to top |
|
 |
alexvanniel
Joined: 20 Feb 2008 Posts: 2
|
Posted: Wed Feb 20, 2008 8:43 am Post subject: |
|
|
Ok, got a little further on this just now...
It seems that you can't do a recreate([["test",null,null],["test2",null,null]]) on a Root that you get from getRoot() but you have to do recreate(["dummy",null,null,["test",null,null],["test2",null,null]])
Thén test and test2 are shown ... HOWEVER, when you do this like a hundred times, you get (hundred * number of nodes to recreate) in the node list because for some reason recreate doesn't delete the old nodes... I suppose this can lead to memory problems if you do this often enough?? |
|
| Back to top |
|
 |
AlexKunin Developer
Joined: 03 Jan 2003 Posts: 1191
|
Posted: Wed Mar 05, 2008 9:44 am Post subject: |
|
|
| Yes, there are some problems with dynamics in COOLjsTree 2.x. We're going to release 3.x soon, and it handles dynamics much better. |
|
| Back to top |
|
 |
|
|