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 

Initialising cooltreepro

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



Joined: 25 Jun 2006
Posts: 4
Location: Scotland

PostPosted: Thu Jul 13, 2006 11:31 pm    Post subject: Initialising cooltreepro Reply with quote

Hi,
Try as I might I cannot get this to work.

I have cooltree initialised and working properly but want to upgrade to Pro. I have two trees on the same page.

Here is my page code
Code:
  </tbody>
</table>
<!-- OUTER TABLE-->
<script type="text/javascript">
var MyTree = new COOLjsTree("tree1", TREE_NODES, TREE_FORMAT);
var Mytree = new COOLjsTree("tree2", TREE_NODES_SUBJECT, TREE_SUBJECT_FORMAT);
</script>
<script type="text/javascript">myTree.init()</script>...
...
<script type="text/javascript">RedrawAllTrees()</script>
</body>
</html>


If I swap cooltree.js for cooltreepro.js the tree fails.

Where have I gone wrong?

Thanks

Dave
Back to top
AlexKunin
Developer


Joined: 03 Jan 2003
Posts: 1191

PostPosted: Wed Aug 16, 2006 7:55 am    Post subject: Reply with quote

Standard and Professional have different initialization sequences. Please, read this doc: http://javascript.cooldev.com/doc/tree/.
Back to top
dphoto



Joined: 25 Jun 2006
Posts: 4
Location: Scotland

PostPosted: Wed Aug 16, 2006 11:30 am    Post subject: Reply with quote

Hi Alex,

I've finally sorted this. My problem was to do with the fact that I am using two trees on the same page.
My code is now
Code:
var MyTree = new COOLjsTreePRO("tree1", TREE_NODES, TREE_FORMAT);
</script>
...
<script type="text/javascript">MyTree.init()
</script>
...
<script type="text/javascript">RedrawAllTrees()
</script>
<script type="text/javascript">
var MyTree = new COOLjsTreePRO("tree2", TREE_NODES_SUBJECT, TREE_SUBJECT_FORMAT);
</script>
...
<script type="text/javascript">MyTree.init()
</script>
...
<script type="text/javascript">RedrawAllTrees()
</script>


Perhaps you could make the initialisation sequence clearer for two or more trees on the same page. It would be good for dunces like me anyway Laughing

Cheers

Dave
Back to top
AlexKunin
Developer


Joined: 03 Jan 2003
Posts: 1191

PostPosted: Wed Aug 16, 2006 3:31 pm    Post subject: Reply with quote

That's why we have samples with two or more trees on the same page. Also, docs clearly say:

Quote:
"tree1" - name of the tree; if you have several trees on the page then you have to name them differently, e.g. "tree1", "tree2" and so on; it is recommended to compose these names using alphanumeric characters because there are many places where names will be used: CSS class names, images' and layers' identifiers - some browsers do not allow to have fancy symbols here (e.g. Opera 5 does not understand CSS class names with underscores);
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