JavaScript.CoolDev.Com Support Forums

Any questions related to JavaScript menu and JavaScript tree menu by Javascript.CoolDev.Com

 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

COOLjsTree Expanded Menu question.

 
Post new topic   Reply to topic    JavaScript.CoolDev.Com Forum Index -> COOLjsTree
Author Message
John
Guest





PostPosted: Sat Dec 13, 2003 3:39 pm    Post subject: COOLjsTree Expanded Menu question. Reply with quote

Hi your script works great but i want to know how do i stop the script expanding the 1st node when it loads up ?
?


Last edited by John on Thu Dec 18, 2003 1:29 pm; edited 2 times in total
Back to top
Guest






PostPosted: Sat Dec 13, 2003 3:46 pm    Post subject: Reply with quote

Doesn't matter i fixed it Smile
It was the:
tree.expandNode(0);
tree.expandNode(1);
I had in my webpage Smile
Back to top
thesahib
Guest





PostPosted: Thu Dec 18, 2003 7:07 am    Post subject: tree.expandNode(0) Reply with quote

How would I set it such that it woudl expand different nodes on different pages ... basically so that when we go into a particular node html page, on that page the menu rebuilds with the appropriate tree-expandnode expanded.

The default whihc works is to expand node(0) and no other node works.

Thanks,
Vinay.
Back to top
AlexKunin
Developer


Joined: 03 Jan 2003
Posts: 1191

PostPosted: Sun Dec 21, 2003 4:25 am    Post subject: Reply with quote

Here you can read about nodeByName() and similar functions - http://javascript.cooldev.com/testdoc/tree/#sIV3. You can use it like this:
Code:
var node = tree.nodeByName("Some node caption");
tree.collapseAll();
if (node) tree.expandNode(node.index)
while (node != null && node.parentNode != tree.rootNode) {
        if (!node.expanded)
                tree.expandNode(node.index);
        node = node.parentNode;
}
Back to top
thesahib



Joined: 18 Dec 2003
Posts: 1

PostPosted: Tue Jan 06, 2004 10:59 am    Post subject: Reply with quote

Sad I've been trying to get it to work with

tree.expandNode(1);

However, it refuses to open any node with the "(1)" ! Shocked

Maybe there is an error in my cool_tree_nodes.js file ... this is how that is made up...

var db = document.all ? '<div style="width:133px">&' : '&&&';
var de = document.all ? '</div>' : '&&&';
var f0 = db+'Home'+de;

var COOL_NODES = [

['<img src="menu/n1.gif" width=145 height=17 border=0>', "", "",
[db+"Overview"+de, "aboutus.html", ""],
[db+"Management"+de, "aboutus-management.html", ""],
[db+"Culture"+de, "aboutus-culture.html", ""],
[db+"Investors"+de, "aboutus-investors.html", ""],
[db+"Careers"+de, "aboutus-careers.html", ""],
],

['<img src="menu/n2.gif" width=145 height=17 border=0>', "", "",
[db+"Overview"+de, "products.html", ""],
[db+"netDeFlect"+de, "products-netdeflect.html", "Display"],
[db+"netDetect"+de, "products-netdetect.html", "Display"],
],

Please do advise. The rest all works so well, it's too cool.

Vinay.
Back to top
greenberginteractive
Guest





PostPosted: Wed Feb 11, 2004 6:38 am    Post subject: How can I expand specific nodes on different pages Reply with quote

I've seen the same question posted a few times, and I have the same one -- How can I open a page and have a specific node expanded?

Example Tree on Page 1:

Node 1
Child Node 1
Child Node 2
Node 2

On page 1, the user opens Node 1 to reveal 2 child nodes. When the user clicks Child Node 1, it links to page 2.
I want Node 1 to remain expanded on page 2, so it still reveals the child nodes in it.

I've seen a script you posted, but I have more questions. The script I saw was:

var node = tree.nodeByName("Some node caption");
tree.collapseAll();
if (node) tree.expandNode(node.index)
while (node != null && node.parentNode != tree.rootNode) {
if (!node.expanded)
tree.expandNode(node.index);
node = node.parentNode;
}
Is this the right code to use?
If so, in what file does it appear?
Can you send me the script with the names I used in my example?
Back to top
AlexKunin
Developer


Joined: 03 Jan 2003
Posts: 1191

PostPosted: Fri Feb 13, 2004 5:54 am    Post subject: Reply with quote

People, if you want complex examples and support, then direct your queries to jssupport@cooldev.com. Forum is for simple and quick questions, not for complete samples.
Back to top
Display posts from previous:   
Post new topic   Reply to topic    JavaScript.CoolDev.Com Forum Index -> COOLjsTree All times are GMT
Page 1 of 1