Board Logo

How can I add an Expand Collapse +/- on the root node?
dcane - 8/14/2003 at 03:44 PM

Hello there. Using the TTM Pro and love it. My questions are regarding the root node. My goal is to have consistent +/- for all nodes including the root node. How can I accomplish this? The inconsistency is that users can double click the root node to roll-up everything, but cannot use a +/- control to do this.

Additionally, is there a way to prevent the double-click action from expanding/collapsing?

Thanks in advance!

Dan Cane

rock - 8/15/2003 at 07:32 AM

This issue has already been discussed.
Please, see
As for your second question: no, there is no way to disable doubleclick action without modifying core script.

dward - 11/11/2003 at 07:16 AM


Actually there is a way to prevent root nodes from "rolling up" without changing tree.js. Just define this function in any of the other files.

function rootNoClose() { return false }

Then add this item scope argument to your root nodes.


var TREE_ITEMS = [
['Home', 0, {'hc':'rootNoClose'},
['ChildNode_1', '', //...etc

Now the "Home" node will not close no matter how many times you click on it.

Also, if you add this next function, nodes will only require one click to open.

function onItemSelectHandler (o_item) {
if (o_item.a_children)

return true;

Don't forget to add this to your tree_tpl.js file.



quietfart - 11/6/2004 at 06:15 AM

hey dan,

thanks for being ultra helpful. however i am still too much of a doofus to get the single-click-to-open to work.

i'm putting the 'onItemSelect':'onItemSelectHandler' at the bottom of the tree_tpl.js file. and then after the }; in the same file, at the very end, i'm inserting the code that you put out here, the function onItemSelectHandler etc. i just copied it verbatim and then the whole tree just decides to not show up. am i missing something?


Back to forum: