Support Forum Softcomplex logo
About Us  | Services  | Download  | Order  | Support  | |
| Search | Today's Posts | Stats | Board Rules | Not logged in [ Login | Register ]
go to bottom
Last active: Never

Printable Version | Subscribe | Add to Favourites   Post new thread
Author: Subject: menu control from outside code
dushik
Newbie

Posts: 1
Registered: 9/8/2003
Location: Ukraine
Member Is Offline
posted on 9/8/2003 at 06:58 AM Reply With Quote
menu control from outside code


How can I control menu items from outside? for example I want to open node by javascript, not by clicking on it. I've tried to do it by placing the code

for (var i = 0; i < this.a_children.length; i++) {
this.a_children[i].open();
}

in the end of tree_item() function, I thought it would result 'expand all', but it didn't work as expected.
View User's Profile View All Posts By User U2U Member
Ulukai
Member

Posts: 40
Registered: 11/27/2002
Location: Frankfurt, Germany
Member Is Offline
posted on 9/24/2003 at 10:10 AM Reply With Quote

Well its ages ago that I used and modified the tree, but I?m sure I can give you some hints.
If you want to open all of the nodes when creating the tree, you will have to add a function. That?s because the init function doesn?t actually initialize the item at the moment when the function returns but returns a string to be rendered by the caller (after rendering the string, the items will be accessable).
You have to create a function recursive_open, that goes through all children and opens them via recursive_open.

this is the body of the function in pseudocode. That should work.

this.open();
for-all-children
thechild.recursive_open(true);

To control the tree via extern controls, you have to know the id of the tree-nodes, which is not that simple, because they are incremented when constructing the tree.
You could write a search-function which returns IDs for node-titles (either you must ensure that node-titles are unique or you have to return an array).
With this function you may control the tree. Then you will have to add another recursive_open-function which goes the other way, calling an item which may be hidden at the moment must force the tree to open all parents of this item.

The body of this function could look like this:
recursive_open2(){
parent.recursive_open2();
this.open(true);
}

I guess the pseudo-code of the functions is far too simple, you will have to experiment with it. But perhaps those hints could help you.
Have fun

Ulukai
View User's Profile View All Posts By User U2U Member
Post new thread

Related Links:
Product Page
Product Demonstrations Live Demos:
Frames targeting
Win help style
Free Download Free Download
Free Download Menu Builders
Online Builder
Product Documentation Documentation:
Documenation Page
Support Forum Technical Support
Support Forum
   

Go To Top


Powered by XMB 1.9.1 Nexus
Developed By Aventure Media & The XMB Group © 2002-2004