| Author |
Message |
lili
Joined: 16 Aug 2004 Posts: 10
|
Posted: Wed Sep 22, 2004 6:56 am Post subject: nodeByID(id) problems |
|
|
Hi,
I'm updating my tree with the nodeByID(id) method. This doesn't work anymore with 2.4.3.
Your new API says nodeByID(id) must be used like this:
[<u>{id:123}</u>, 'Caption', 'Url.html', ...],
What is the <u>- tag for? When I use this tag as in the example, my tree isn't drawn at all.
Also, if I go back to using 2.3.1 my nodes without children don't display.
What can I do?
lili |
|
| Back to top |
|
 |
Torquemada
Joined: 14 Sep 2004 Posts: 11
|
Posted: Wed Sep 22, 2004 11:17 am Post subject: |
|
|
lili, did you try it without the <u> tag? So just:
| Code: | | [{id:123}, 'Caption', 'Url.html', null] |
I use nodeById with version 2.4.3 and it works ok, without the <u> tag |
|
| Back to top |
|
 |
lili
Joined: 16 Aug 2004 Posts: 10
|
Posted: Wed Sep 22, 2004 3:29 pm Post subject: |
|
|
Hi Torquemada (real name? )
I'm using this patch to sychronize my tree in the leftFrame with the page in the mainFrame when the page is opened from a link outside the tree:
leftFrame contains:
window.$tree = tree;
window.updateTree = function (id) {
var tree;
tree = window.$tree;
var node = tree.nodeByID(id);
tree.collapseAll();
if (!node)
return;
tree.expandNode(node.index)
while (node != null && node.parentNode != tree.rootNode){
if (!node.expanded)
tree.expandNode(node.index);
node = node.parentNode;
}
}
}
RedrawAllTrees();
and mainFrame contains:
<body onload="if (top && top.frames && top.frames.leftFrame && top.frames.leftFrame.updateTree) top.frames.leftFrame.updateTree(37)">
It works perfectly if I use script version 2.3.1, but if I change to script version 2.4.3 it won't work anymore (I've changed nothing else).
I must admit that I can't figure out why and I was assuming nodeById() wasn't working. Can you help me figure out which part of my patch won't work with the new tree version?
Many thanks,
lili |
|
| Back to top |
|
 |
Larry
Joined: 23 Sep 2004 Posts: 4 Location: Portland, OR
|
Posted: Thu Sep 23, 2004 3:06 pm Post subject: |
|
|
I have this same problem.
Using the syntax without the <u></u>, nodeByID returns nill (as shown in the firefox venkman javascript debugger.)
Using the syntax the docs specify results in the entire tree being nill.
Here is the code I need to work. This is supposed to ensure the path to a given page is alway evident to the user no matter how we got to the page:
| Code: |
<script type="text/javascript">
function expandToNode(tree,id){
var node= tree.nodeByID(id);
tree.selectNode(node.index);
while( node.level() > 0 ){
node= node.parentNode;
if( node.expanded == false )
tree.expandNode(node.index,false,false);
}
}
RedrawAllTrees()
expandToNode(tree,1);
</script>
|
|
|
| Back to top |
|
 |
Flesh
Joined: 24 Sep 2004 Posts: 2
|
Posted: Fri Sep 24, 2004 9:28 pm Post subject: |
|
|
| Larry wrote: |
| Code: |
<script type="text/javascript">
function expandToNode(tree,id){
var node= tree.nodeByID(id);
tree.selectNode(node.index);
while( node.level() > 0 ){
node= node.parentNode;
if( node.expanded == false )
tree.expandNode(node.index,false,false);
}
}
RedrawAllTrees()
expandToNode(tree,1);
</script>
|
|
I get: RedrawAllTrees is not defined, how do i get that function ?!
Tnx in advance  |
|
| Back to top |
|
 |
Larry
Joined: 23 Sep 2004 Posts: 4 Location: Portland, OR
|
Posted: Fri Sep 24, 2004 9:57 pm Post subject: |
|
|
RedrawAllTrees is in the pro version.
In fact, this thread is discussing the 2.4.3 preview which comes with different docs than those on
http://javascript.cooldev.com/doc/tree/ |
|
| Back to top |
|
 |
Flesh
Joined: 24 Sep 2004 Posts: 2
|
Posted: Sat Sep 25, 2004 7:09 am Post subject: |
|
|
ah cool, i am thinking about getting the pro version, is it really worth it ? |
|
| Back to top |
|
 |
Larry
Joined: 23 Sep 2004 Posts: 4 Location: Portland, OR
|
Posted: Sat Sep 25, 2004 3:43 pm Post subject: |
|
|
You'll have to compare features and make that decision for yourself.
So far, the nodeByID problem prevents me from being able to use the 2.4.3 version while the shipping version, 2.3.1, doesn't work properly with Safari or Firefox (search for DOCTYPE on this forum) |
|
| Back to top |
|
 |
lili
Joined: 16 Aug 2004 Posts: 10
|
Posted: Tue Sep 28, 2004 3:20 pm Post subject: is 2.4.3 worth it? |
|
|
I could not solve the problem I posted here with 2.4.3 so I have gone back to using 2.3.1 which works well for me - also in Safari and Fireworks.
I wanted to use 2.4.3 because I want my folder images to be clickable. I had clickable folder images when I was using the free version, but I lost this functionality when I upgraded to 2.3.1 (which I'm using because of it's ability to highlight the text of a selected node).
All in all 2.4.3 seems too buggy right now.
lili |
|
| Back to top |
|
 |
Torquemada
Joined: 14 Sep 2004 Posts: 11
|
Posted: Tue Oct 12, 2004 9:03 am Post subject: |
|
|
lili, check out the new version 2.4.6:
"2.4.6: dynamic API - initial model: recreate, setCaption, addNode, deleteNode; new method - node.ensureVisible: expands all ancestors of particular node; all nodeBy functions are fixed now"
 |
|
| Back to top |
|
 |
AlexKunin Developer
Joined: 03 Jan 2003 Posts: 1191
|
Posted: Wed Nov 17, 2004 7:50 pm Post subject: |
|
|
| 2.4.3 had problems with nodeBy* methods. These problems were fixed in 2.4.6. |
|
| Back to top |
|
 |
|