Commenting out the call to this.a_children.open(); collapses all of the nodes for me. However, the user may not be aware that there is a tree
underneath the icons. How can it default to collapsed and have the [+] symbols at the root nodes?

Thanks.

jennih

Junior Member

Posts: 2
Registered: 4/22/2006
Location: UK
Member Is Offline

posted on 4/22/2006 at 11:09 AM

I needed the same this for a VLE I'm designing for a school (want each section as a different tree for managability) so I just had a hack at the code
and came up with his.

Be warned though this is a major league cludge and I take no responsibility if it falls on it's face! :)

Ok, so you know there are a few alterations in here.

1) Changable target for each item.

I do this by cheating and removing the quotes, this allows you to just type the target in the URL section. However there are two things to watch for.
One is that it no longer responds to the target entry in tree_tpl, and secondly without quotes it really doesn't like urls with spaces or weird
characters.

2) Collapsed base node. There is a new parameter to turn this on and off (just a true false switch on the new tree command) . Set it to false and
you collapse to the root node.

3) Leading spaces. Another parameter on the new tree line, it adds leading spaces to the tree to pad it out from the left, set it to 0 to have no
padding.

4) plus/minus symbols on the root node. again this is a parameter on the new tree line. true for on, false for off. This is a big cludge and the
path to the plus + minus symbols are hard coded into tree.js so you'll have to change where they point. There is definately a more elegant way to
do it, but this isn't bad for 3 hours playing this afternoon.

2) extra parameters are now optional and set themsevelf to the standard usage if left out.

3) Also, all the parameters are false for "don't use" (originally the openbase parameter was false for use) this means
['fred','fred.html',false,0,false] or just ['fred','fred.html'] is all extras off.

4) The path for the cludged icons is now on a variable. Either set it at the top of tree.js or take it our and set it in each html doc if you want
(handy for multi layer web sites).

The upshot of all this is if you use this tree.js without putting in any of the extra settings, it will work as if it is unaltered. So it's still a
cludge, but now it's a compatable cludge. :)

EDIT: Noticed two bugs that are now fixed, and if you are using the standard plus and minus gifs you'll get dotted lines going the wrong way. Simple
fix is to make a new gif and point to it. (I'm using the lay out without lines so didn't notice)