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 

Expands tree automaticlly when page is loaded

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





PostPosted: Wed Feb 04, 2004 7:11 pm    Post subject: Expands tree automaticlly when page is loaded Reply with quote

ok... I know there are a few posts below that reference this. I have tried those suggestions and it still will not expand when I code the call....

var node = tree.nodeByName("nodename");

The tree still works... it just will not expand. Code listed below.

1st try was:
var myTree = new COOLjsTree("tree1", TREE1_NODES, TREE1_FORMAT);
var node1 = tree1.nodeByName('Application Mangement');
exp(node1);


2nd try was:

var myTree = new COOLjsTree("tree1", TREE1_NODES, TREE1_FORMAT);
var node = tree.nodeByName("Application Mangement");
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;
}

Neither of those are working...
suggestions?
Back to top
AlexKunin
Developer


Joined: 03 Jan 2003
Posts: 1191

PostPosted: Mon Feb 09, 2004 7:13 pm    Post subject: Reply with quote

In your first attempt you are creating tree "myTree", and rest of your code refers to "tree1". This is incorrect way to do things since tree name has nothing to do with variable name which holds that tree. Your second attempt also does same wrong thing: "myTree" holds the tree, but code references "tree". Correct this, and then your second will work as expected.
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