Simple website navigation menu using dhtmlxtree

Hi.

I have been using a tree menu system (see link below) very similar in appearance and in operation to dhtmlxtree for my personal website.
[url]http://globalsoftwarearchive.dynamicdns.co.uk:8080/beta2/tree/demoLarge.html[/url].

Whilst looking for scripts on various websites I stumbled across dhtmlx.com and was very impressed.
I have now downloaded dhtmlxAccordion (standard) and dhtmlxTree (standard) and am starting to play with the code.

Here is what i want dhtmlxTree to do:

  1. Make the “Folders” open/expand and close/retract with a single click on it’s name. See #1 below.
  2. Make the “Files” open in a frame with a single click on it’s name. See #2 below.
  3. Make the previous “Folder” close/retract when i open/expand another “Folder” on the same menu level. See #3 below.

Here is what i’ve got so far:

tree.attachEvent("onClick",function(id){
if(tree.getOpenState(id)!=1) tree.openItem(id);
document.frames["Name_of_Frame"].location.href=tree.getUserData(id,"url");
return true; }); 
}

After trawling through the samples, documentation, and this forum I have come up with the code above, but this still doesn’t fully complete what i want the dhtmlxTree to do.

Using the above code:
#1. The “Folders” will open/expand with a single click on the name. How do I make them close/retract in the same way?
#2. The “Files” open in the frame as long as there is a “url” in the XML file, However all the “Folders” also try to open something in the frame when i single click on them. How do I stop this happening?
#3. How do I make the “Folders” do this?

I am new to writing/modifying scripts (ASP, Javascript etc), so all the help and detail you can give me would be much appreciated.

Many thanks.

Hi,

Make the “Folders” open/expand and close/retract with a single click on it’s name. See #1 below.

viewtopic.php?f=3&t=88&p=38721#p38721

Make the “Files” open in a frame with a single click on it’s name. See #2 below.

take a look at the solution here:
viewtopic.php?f=3&t=13209

Make the previous “Folder” close/retract when i open/expand another “Folder” on the same menu level. See #3 below.

You may get item parent:

docs.dhtmlx.com/doku.php?id=dhtm … etparentid

and check open state for its child nodes as you need. Method getSubItems return the list of child items:

docs.dhtmlx.com/doku.php?id=dhtm … etsubitems