displaying relationships

liunx

Guest
I've populated an array of parents & children. Some children are also in the parents column because they have children. I want to display their relationship like a family tree. The data in the array will be dynamic. Not sure how to go about this, help! <br />
thanks, <br />
archie<!--content-->Tree hierarchy and array are two different things. Do not confuse them. <br />
If you have a tree structure with parent-child relationships, you can not effectively present them in an array. See my DOM Tree Viewer (<!-- m --><a class="postlink" href="http://www.vladdy.net/webdesign/DOM_TreeViewer.html">http://www.vladdy.net/webdesign/DOM_TreeViewer.html</a><!-- m -->) for a possible solution.<!--content-->do you have an example of what your code does, how it looks real time? I suppect its alot more than I need & I'm like you I don't what to clutter up my pages with unnecessary code. I don't need to expand or colaspe anything. Just want to show the whole family with the current data. I might make them active links, not sure yet if thats needed.<!--content-->In the link I gave above click on DisplayDOM('content'). It will pop up a window with the collapsed tree of DOM objects. You can navigate it by expanding/collapsing different branches. For this particular application I found it to be a preferrable presentation method due to a sicnificant number of nodes. <br />
If your number of nodes is limited and you want to present them all expanded, just go with nested lists.<!--content-->Now you already know my next Q. Do you have any examples of nested list?<br />
thanks again<!--content-->The actual implementation would depend on your data structure. As far as the code goes it is nothing more than dynamic creation of node tree representing your data tree using <br />
with(document.createElement('ul'))<br />
{ with(appendChild(document.createElement('li')))<br />
{ appendChild(document.createTextNode(data));<br />
}<br />
}<!--content-->
 
Back
Top