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 

Two different tree nodes on the same page?

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



Joined: 24 Apr 2005
Posts: 4

PostPosted: Sun Apr 24, 2005 11:04 pm    Post subject: Two different tree nodes on the same page? Reply with quote

I'm designing a page where I have 2 different trees. One will be on the left side and one on the right side of the page.

The left nav and right nav will have totally different links, but will share the same look and feel. Can this script support this? I've tried to call 2 different node files (I use .js files), but the script doesn't want to load either node.

Any ideas on how I can do this or if it is possible?

Thanks
Back to top
AlexKunin
Developer


Joined: 03 Jan 2003
Posts: 1191

PostPosted: Tue Apr 26, 2005 8:47 am    Post subject: Reply with quote

Yes, tree supports this. You have to specify different names for each of these trees. Look at the following code:
Code:
var tree1 = COOLjsTreePRO('myTree1', ...);
var tree2 = COOLjsTreePRO('myTree2', ...);
Back to top
bkdell11



Joined: 24 Apr 2005
Posts: 4

PostPosted: Wed Apr 27, 2005 10:04 pm    Post subject: Reply with quote

Thanks for the reply

Specifying just different tree names doesn't seem to solve the problem. Here's what I have loaded in the <head> part of the page
Code:
<script language="JavaScript" src="navtree.js"></script>
<script language="JavaScript" src="otn_nodes.js"></script>
<script language="JavaScript" src="obe_master_nodes.js"></script>
<script language="JavaScript" src="ocom_format.js"></script>
<script language="JavaScript">
    var treeName = "Tree1";
    var treeName = "Tree2";
    var tree1 = new COOLjsTreePRO (treeName, OTN_ALL_CLOSED_NODES, TREE_FORMAT);
    var tree2 = new COOLjsTreePRO (treeName, OBE_AS10G_904_NODES, TREE_FORMAT);
</script>


So I want otn_nodes to display on the left and obe_master_nodes to display on the right. So here's what I put in those 2 spots:
Code:
<script language="JavaScript">
    tree1.init();
</script>


<script language="JavaScript">
    tree2.init();
</script>


When I do this, I get javascript error on line 351, char 4. 'this.el.style' is null or not an object. Which I think refers to navtree.js file

Neither node gets displayed. I feel I'm close to solving, but not quite there.

Thanks
Back to top
Victor_Chuiko
Support Team


Joined: 12 Apr 2005
Posts: 145

PostPosted: Wed Apr 27, 2005 11:31 pm    Post subject: Reply with quote

You must have misprinted. You are trying to store two tree names in one variable.
Code:
var treeName = "Tree1";
var treeName = "Tree2";

You just need to correct it like this:
Code:
 var treeName1 = "Tree1";
var treeName2 = "Tree2";
var tree1 = new COOLjsTreePRO (treeName1, OTN_ALL_CLOSED_NODES, TREE_FORMAT);
var tree2 = new COOLjsTreePRO (treeName2, OBE_AS10G_904_NODES, TREE_FORMAT);

Also you might need to do the same with TREE_FORMAT, If there is a proble hust copy your TREE_FORMAT and name it something like TREE_FORMAT2.
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