Open all / Collapse all

Explorer like navigation tree for websites
Navigationsbaum für Internet Auftritte.
Post Reply
Mr. Inkognito

Open all / Collapse all

Post 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!
User avatar
Hans
Site Admin
Posts: 77
Joined: 16 Dec 2005, 16:52
Location: Germany
Contact:

Open a tree up to a specified level

Post 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
Your forum admin
Mr. Inkognito

Re: Open a tree up to a specified level

Post 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 :)
swaze
Posts: 3
Joined: 23 Dec 2005, 09:50
Location: Mexico

Re: Open all / Collapse all

Post by swaze »

Thanks, also for your support!
I use your script since many years: It's ahead of competition, earlier and still today.
Ask silly to get clever answers
Post Reply