Support Forum Softcomplex logo
About Us  | Services  | Download  | Order  | Support  | |
| Search | Today's Posts | Stats | Board Rules | Not logged in [ Login | Register ]
go to bottom
Last active: Never

Printable Version | Subscribe | Add to Favourites   Post new thread
Author: Subject: One click for expansion of folder
thomaspk
Junior Member

Posts: 4
Registered: 11/1/2004
Member Is Offline
posted on 11/16/2004 at 02:49 PM Reply With Quote
One click for expansion of folder


Hi all,

I found the following lines somewhere in the forum but I can't find them anymore:



"Hi,

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.

{'hc':'rootNoClose'}

e.g.
var TREE_ITEMS = [
['Home', 0, {'hc':'rootNoClose'},
['ChildNode_1', 'example.com', //...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)
o_item.o_root.toggle(o_item.n_id)

return true;
}

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

'onItemSelect':'onItemSelectHandler'

Enjoy,
Dan"




What I want to acchieve is that if somebody clicks on a folder ONCE that then the folder expands its leafs.

So I tried the following in tree_tpl.js:

function onItemSelectHandler (o_item) {
if (o_item.a_children)
o_item.o_root.toggle(o_item.n_id)

return true;
}

var tree_tpl = {
'target' : 'mainFrame', // name of the frame links will be opened in
// other possible values are: _blank, _parent, _search, _self and _top

'onItemSelect':'onItemSelectHandler',
'icon_e' : 'tree/icons/empty.gif', // empty image ....

But this doesn't work.

As I am a JS-Dummy I'd be happy if somebody tells me step by step what to do.

Thanks

Thomas
View User's Profile View All Posts By User U2U Member
rock
Moderator

Posts: 687
Registered: 4/15/2003
Member Is Offline
posted on 11/18/2004 at 09:59 AM Reply With Quote

Are you sure you're using PRO version of the control?
View User's Profile View All Posts By User U2U Member
thomaspk
Junior Member

Posts: 4
Registered: 11/1/2004
Member Is Offline
posted on 11/18/2004 at 03:00 PM Reply With Quote

No, I'm not using the pro version of the tigra tree menu.

Was this an instruction for pro users or what do you mean by "PRO version of the control"?

Thomas
View User's Profile View All Posts By User U2U Member
rock
Moderator

Posts: 687
Registered: 4/15/2003
Member Is Offline
posted on 11/18/2004 at 03:12 PM Reply With Quote

Yes, free version does not supports API, it has open source instead.
View User's Profile View All Posts By User U2U Member
thomaspk
Junior Member

Posts: 4
Registered: 11/1/2004
Member Is Offline
posted on 11/23/2004 at 08:54 AM Reply With Quote

Does this mean I can not realize this one-click-thing in the free version?

Thomas
View User's Profile View All Posts By User U2U Member
rock
Moderator

Posts: 687
Registered: 4/15/2003
Member Is Offline
posted on 11/23/2004 at 10:34 AM Reply With Quote

Try to find sollution inside discussion:
http://www.softcomplex.com/forum/viewthread_1127/
View User's Profile View All Posts By User U2U Member
Joaquin
Junior Member

Posts: 2
Registered: 11/17/2005
Location: Michigan
Member Is Offline
posted on 11/17/2005 at 11:18 PM Reply With Quote
Free Version - Single Click to Expand


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.

example:
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.
View User's Profile View All Posts By User U2U Member
Post new thread

Related Links:
Product Page
Product Demonstrations Live Demos:
Frames targeting
Win help style
Free Download Free Download
Free Download Menu Builders
Online Builder
Product Documentation Documentation:
Documenation Page
Support Forum Technical Support
Support Forum
   

Go To Top


Powered by XMB 1.9.1 Nexus
Developed By Aventure Media & The XMB Group © 2002-2004