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 

Dynamic menu question

 
Post new topic   This topic is locked: you cannot edit posts or make replies.    JavaScript.CoolDev.Com Forum Index -> COOLjsTree
Author Message
corto



Joined: 24 Feb 2005
Posts: 10

PostPosted: Thu May 11, 2006 1:31 pm    Post subject: Dynamic menu question Reply with quote

Hello!

How should I handle "collapseAll()" and other Javascript functions if I retrieve urls from database?

Usually, If I use "tree1_nodes.js", I can add Javascript to url like this:

<a href="link.html" onclick="javascript:void(tree1.selectNode(1));tree1.collapseAll();return true;">

But how do I do it with dynamic menu?
I'm using your PHP + MySQL CGI sample.
Back to top
AlexKunin
Developer


Joined: 03 Jan 2003
Posts: 1191

PostPosted: Thu May 11, 2006 11:00 pm    Post subject: Reply with quote

Actually, database matters are unrelated to collapseAll and such. These are completely independent layers. Please, explain your issue in some other terms.
Back to top
corto



Joined: 24 Feb 2005
Posts: 10

PostPosted: Fri May 12, 2006 9:52 am    Post subject: Reply with quote

Hello Alex,

Yes, my example wasn't very good.
I'm developing site here: http://www.palomuseot.fi/default.php

If you choose first link "Suomen palomuseot" tree expands ok. If you then click the last link "Etusivulle" which hasn't any sub pages, "Suomen palomuseot" stays open Sad

It would be great if tree could collapse every time when main level links are clicked.
Should I include javascript somewhere?
Back to top
AlexKunin
Developer


Joined: 03 Jan 2003
Posts: 1191

PostPosted: Fri May 12, 2006 1:04 pm    Post subject: Reply with quote

You're using "Single branch mode". In this mode clicking any node with children will collapse all other nodes. This is behavior by design.

If you want have same behavior for childless nodes, you should make them look like ones with children, e.g.:

Code:
['My node', 'file.html', null, {format:{isFolder:true}}],
Back to top
corto



Joined: 24 Feb 2005
Posts: 10

PostPosted: Wed May 17, 2006 11:10 am    Post subject: Reply with quote

Ok, how should I use your code when I retrieve urls from mysql database?
Back to top
AlexKunin
Developer


Joined: 03 Jan 2003
Posts: 1191

PostPosted: Wed May 17, 2006 11:15 am    Post subject: Reply with quote

Your server-side code generates TREE_NODES variable. So, {format:{isFolder:true}} must be inserted into some part of your server-side logic. I can't tell exact place until I see your code.
Back to top
Display posts from previous:   
Post new topic   This topic is locked: you cannot edit posts or make replies.    JavaScript.CoolDev.Com Forum Index -> COOLjsTree All times are GMT
Page 1 of 1