Fred just posted a good way to handle sub-branches of a tree, particularly
if you're using the ID, ParentID traditional way of handling a tree and have
access to any of the MakeTree custom tag variants.

But if you're asking about Nested Trees, as in Nested Sets a la Celko, which
is different than what Fred just answered, then the issue is entirely
different, and  your answers would be:

> 1.) How can I display only one branch of the tree?  For example: If I
click on 'ColdFusion' it displays only that branch with all the connecting
branches/children underneath it (ending with the branch 'Nested Trees').

remember that all parents "wrap" around all their desecendent children. some
people like the worm traveling metaphor, others the traditinoal Venn diagram
metaphor, personally I like the XML analogy.  So you look up the Left and
Right of the parent and then by definition all the children and sub-children
will have lefts and rights that are between these numbers
so construct a query which for a given Node X, retrieves XLeft and Xright,
and then query for all nodes that have Left >= Xleft and Right <= XRight
(kill the equal signs if you dont want the root parent)

> 2.) Is there a way to hide certain children but display others? For
example: Say I wanted a person to click on 'ColdFusion' and they could see
the attatched children but they wouldn't be able to see the children
attatched to 'ColdFusion's children ('Advanced Techniques' would be visable
but it's children 'WDDX', 'Error Handling', 'Nested Trees' would not).

yes this is straightforward too, though off the top of my head I cant
remember the algorithm. However, it's just a variant on the above with some
additional filters.

as a side comment a lot of the code for this has already been written in SQL
(but i dont think it works in Access since they are SPs) if you track down
web references to the original author Joe (?) Celko. He even has a web site
:)   he also publishes regularly in InteligentEnterprise, and did an article
on this last october, which will at least be a good starting point

www.intelligententerprise.com/001020/celko.shtml


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm

Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to