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 

collapse/open only on click on icon

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



Joined: 15 Jun 2003
Posts: 1

PostPosted: Sun Jun 15, 2003 4:25 pm    Post subject: collapse/open only on click on icon Reply with quote

Is it possible for the tree only collaspe/open on the click on icon but not on the node text? If yes, how can we do that? Thanks for the help.
Back to top
AlexKunin
Developer


Joined: 03 Jan 2003
Posts: 1191

PostPosted: Sun Jun 15, 2003 6:43 pm    Post subject: Reply with quote

First parameter of node definition will be inserted into <A></A>, which will contain click handler. You can disable this handler like in the following sample.
Code:
['</a>Caption<a>', null, null],

But you also will need to assign some CSS class to the node, or assign some default fonts to BODY and DIVs.
Back to top
Bruce



Joined: 11 Jul 2003
Posts: 5
Location: New Zealand

PostPosted: Sat Aug 30, 2003 10:31 am    Post subject: More details please Reply with quote

Alex,

I'd like to make this change in my code - can you tell me where I'm going to find the necessary code to effect this change *permanently*. I am generating my trees dynamically from a database, so I need to make this change at the source.

Thanks,

Bruce
Back to top
AlexKunin
Developer


Joined: 03 Jan 2003
Posts: 1191

PostPosted: Mon Sep 01, 2003 12:49 am    Post subject: Reply with quote

Sure, you can modify source code of the script. But on the next release you will have to apply this patch again.
There is two more places where you can put some code to achieve same effect: 1) you can change your CGI script which generates tree structure and 2) you can (or I can if you prefere) write tiny JavaSctipt function which will walk-and-modify ready tree structure before passing it to COOLjsTree or COOLjsTreePRO.
Back to top
Bruce



Joined: 11 Jul 2003
Posts: 5
Location: New Zealand

PostPosted: Mon Sep 01, 2003 9:24 am    Post subject: Arresting collapse Reply with quote

Thanks Alex, but I now see that my question was poorly presented.

I altered my tree-generating script and achieved what your answer indicated. However, that was not what I wanted. I use the caption element to launch a particular process elsewhere in my page - you previously supplied the code for this.

Is it possible to
1. Retain the live caption but stop its click handler from collapsing the node
and
2. Constrain the click handler that controls the collapsing/opening of the node to just the icon?

Hope I have made this clearer.

Cheers,

Bruce
Back to top
AlexKunin
Developer


Joined: 03 Jan 2003
Posts: 1191

PostPosted: Tue Sep 02, 2003 10:17 am    Post subject: Reply with quote

Yes, now I see.
There are two ways:
1. ['</a><a href="your_own_link.html">Caption</a><a>', null, null],
Since your tree is DB driven this will not be too hard to implement this.
2. Patched version of the script. Sure, I will not publish patch here - plese, send you request along with Ref.No. to jssupport@cooldev.com.
Back to top
guldam
Guest





PostPosted: Thu Nov 06, 2003 11:53 pm    Post subject: bold selected node and collapse/open node only on icon Reply with quote

I tried this in my cooljstreePro and it works fine and dandy. However now my bold-selected node no longer bolds. Is there an easy way to do this?


['</a><a href="your_own_link.html">Caption</a><a>', null, null],


guldam
Back to top
AlexKunin
Developer


Joined: 03 Jan 2003
Posts: 1191

PostPosted: Mon May 10, 2004 8:33 am    Post subject: Reply with quote

You need additional CSS reference. If you CSS class was clsNode, then you should define your nodes like this:
Code:
['</a><a class="clsNode" href="your_own_link.html">Caption</a><a>', null, null],

Or you can use inline <b> tag:
Code:
['</a><b><a href="your_own_link.html">Caption</a></b><a>', null, null],
Back to top
dmeysman



Joined: 07 Feb 2004
Posts: 14

PostPosted: Fri Jun 11, 2004 3:28 pm    Post subject: Same topic but using frames Reply with quote

Hi Alex,

Is there any way to do exactly what is discussed here but within the context of frames?

I would want to click on the node's text, not have the tree collapse/exand, and have the page display in a frame other that where the tree is displayed.

David
Back to top
dmeysman



Joined: 07 Feb 2004
Posts: 14

PostPosted: Fri Jun 11, 2004 4:42 pm    Post subject: Working within frames Reply with quote

As this sat in the back of my mind for a while, I realized that the answer to this is simply to use the 'target attribute of the <a> anchor tag:

['</a><b><a href="your_own_link.html target=your_target_frame">Caption</a></b><a>', null, null],

In this way, the display can be targeted to any frame in the overall frameset.

David
Back to top
dmeysman



Joined: 07 Feb 2004
Posts: 14

PostPosted: Fri Jun 11, 2004 5:58 pm    Post subject: 'Selected node' highlighing nolonger working Reply with quote

Alex,

(I hope I won't be answering this myself again after 2 minutes).

After doing all the above suggestions, the node selected (clicked by the user) nolonger shows itself to be highlighted after the node is selected.

In the tree_format, option 21 is 'true'. Adding a .clsNodeSelected class to option 22 does not seem to help either.

David
Back to top
AlexKunin
Developer


Joined: 03 Jan 2003
Posts: 1191

PostPosted: Tue Jun 15, 2004 5:58 am    Post subject: Reply with quote

I think it is time for you to upgrade to newer version of the Pro - it provides advanced control for event handlers. Ask at jssupport@cooldev.com (don't forget your Ref.No.).
Back to top
Torquemada



Joined: 14 Sep 2004
Posts: 11

PostPosted: Thu Sep 16, 2004 12:47 pm    Post subject: Reply with quote

I have finally figured out how to do this, with a bit of help from Alex Kunin and after looking in the tree's js code, the trick is to override the onclick handler for the caption, like this:

Code:
<script language="JavaScript">
var tree0 = new COOLjsTreePRO("zeroTree", TREE_NODES, TREE_FORMAT);
   // override the default behaviour of clicking on a caption
   // does the same as normal except no expand/collapse
   tree0.caption_onclick = function (node) {
      this.selectNode(node.index);
      this.draw();
      return true;
   }
</script>


This works fine with the most recent PRO version 2.4.3 - I don't know if it will work with other versions.
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