[thelist] Large expandable tree

Tom Dell'Aringa pixelmech at yahoo.com
Wed Aug 27 18:35:07 CDT 2003

--- Hershel Robinson <hershelr at netvision.net.il> wrote:
> I have a page which shows an expandable/collapsible tree of nodes.
> The server prints out the nodes in a JavaScript array and the 
> client side code builds the tree.
> I am using a modified version of the tree code found here:
> www.destroydrop.com/hugi/javascript/tree/

> The boss says that a 1500 node tree takes 2 minutes to build and we
> may soon be seeing 6K nodes.

Hershel, not sure if this is robust enough but look here:


Add as many nodes as you want. The whole script is:

function ToggleSection(node) 
	var nodeArray = node.childNodes;
	for(i=0; i < nodeArray.length; i++)
		node = nodeArray[i];
		if (node.tagName && node.tagName.toLowerCase() == 'div')
      		node.style.display = (node.style.display == "block") ? 'none'
: 'block';

It might at least point you in the right direction...



http://www.pixelmech.com/ :: Web Development Services
http://www.DMXzone.com/ :: Premium Content Author / JavaScript / Every Friday!
http://www.maccaws.com/ :: Group Leader
[Making A Commercial Case for Adopting Web Standards]

"That's not art, that's just annoying." -- Squidward

More information about the thelist mailing list