Probably your best bet would be to assign each of your items in the tree a unique identifier, and then in your html keep the info of which branches are expanded. Like a hidden field that looks something like "00,05,0A,2B" something like that, or else maintain a state in a session on the system. Then you link the items to change state with something like an expand or collapse command containing its identifier. Or you could put it in all the links, thought that would make your html much longer...
?expanded=00,05,0A,2B&collapse=2B
of course, I'm sure there are many other ways to do it.
                - Ant

In reply to Re: collapsable tree by suaveant
in thread collapsable tree by Sadmachine

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.