Page 1 of 1

Open all / Collapse all

Posted: 08 Feb 2007, 04:12
by Mr. Inkognito
Hello Hans,

I have to write, that your treemenu is absolutely the best what I ever saw! Easy to use for dynamic generating, great stuff! But I've a little question. Is in your Treemenu ability to open and collapse all? I know that in "downloadable sample" is somethink like configuration at the top of the menu - I can choose how deep links I wish to get open. But is there any chance to have one link to open all tree? For example:

Code: Select all

<a href="javascript:tree.OpenAll();">Open All</a>
Sorry my english and Thank you for so great navigation menu!

Open a tree up to a specified level

Posted: 08 Feb 2007, 08:26
by Hans
Hello Mr. Inkognito,

thank you for using TreeMenu and for you praise. You were really close to the solution. When you created your tree with

Code: Select all

myTree = new treemenu(...);
you can open all nodes up to a specified level/indent e.g. '2' by

Code: Select all

myTree.level(2);
To include this action into a link, just write

Code: Select all

<a href="javascript:myTree.level(2);">Open to level 2</a>
To open all nodes, replace "2" with the depth of your tree. You also might receive the depth of your tree using the variable

Code: Select all

myTree.maxIndent
For more informations you also might have a look into the code of "config.js", especially the routines "fillLevelList" to read out the depth of the tree and to fill the drop-down-list of config as well as the routine "clickLevel" to set the open-level for the tree.
I hope this reply was useful for you.
With my very best wishes
Hans Bauer

Re: Open a tree up to a specified level

Posted: 08 Feb 2007, 15:08
by Mr. Inkognito
Hello Hans,

I've to tell you the truth - you shocked me! I really don't expect so fast support! Thank you once again very much! You're javascript God :)

Re: Open all / Collapse all

Posted: 02 Nov 2011, 12:59
by swaze
Thanks, also for your support!
I use your script since many years: It's ahead of competition, earlier and still today.