Page 1 of 1

autopen to certain level

Posted: 13 Mar 2006, 10:31
by woid
Hello

How do I make the treemenu autoopen to a certain level without having to use the configuration panel?

Auto-Open a Level

Posted: 13 Mar 2006, 11:15
by Hans
Hi 'Woid',

there are two possibilites to open a tree up to a specified level:

1. You can set the variable 'open' in the commands 'add' or 'put' according to the explanations in the help (TreeMenu -> First steps -> Menu items). By this you can set the open/close state of each tree/subtree according to your wisches. E.g. you can open the first subtree up to level four and the second subtree up to level 2,...

2. To open the tree up to a specified level for all subtrees you may call the routine 'level' and manually set the desired level-number. E.g. to open your instance 'yourTree' of the TreeMenu up to level 2 you may code:

Code: Select all

yourTree.add(...);
...
yourTree.level(2);
document.write(yourTree);
in your menu-file.

But remind: If the visitor requested cookies, the tree will be opened with the settings (open/close state for each item) according his last visit. To reset to the defaults, the visitor must clear his cookies.

I hope the above explanations are useful for you. Could you please reply and tell me if it's working as desired?

Thanks
Hans Bauer

Posted: 13 Mar 2006, 12:01
by woid
Thanks for the help. It worked perfectly. Option nr 2 was just the thing I was looking for.