Board Logo

Expand Node on Single Click
Joaquin - 11/17/2005 at 11:19 PM

Ok, after 2 days of staring at this code, I have finally figured out how to have the nodes expand when you just "single" click on the name of the node not just the "+".

This is my first post so please be gentle.

Inside tree.js you will find a function called "item_init()".

Inside this function you will see a very long "return" statement.

Inside this return statement you will see various events such as onmouseover/onmouseout and then onclick and ondblclick.

ondblclick="trees[' + this.o_root.n_id + '].toggle(' + this.n_id + ')"

What you want to do is to highlight and copy everything in between the double quotes after ondblclick=.

What you want to have copied is:
trees[' + this.o_root.n_id + '].toggle(' + this.n_id + ')

Now, what you need to do is to paste this code into the event right before "ondblclick", which is "onclick". After the paste add a semicolon and a space before the code that was already there.

What you want is your "onclick" call to look like this:

onclick="trees[' + this.o_root.n_id + '].toggle(' + this.n_id + '); return trees[' + this.o_root.n_id + '].select(' + this.n_id + ')"

So now the node will be selected and open on a single click.

Hope this helps someone!

Back to forum: