While not EXACTLY what you outlined, I've used TreeView
http:www.treeview.net along with Python to create the
dynamic tree menus you describe.  I had to write a
couple or very short JavaScript additions, but it is
working just fine.  All the tree opening and closing
is done on the client via-javascript so it is very
fast.

Larry Bates


Gregor Horvath wrote:
Hi,

Before I reinvent the wheel I`d like to ask if someone has done this before since I did not find an advice at Google.

The goal is to create a dynamic Tree View in HTML.

Say I have a data strucure like this:

structList = {'Sun':{'Sun.1':['Sun1.1','Sun1.2'],'Sun.2':['Sun2.1','Sun2.2']},'Kupa':['Kupa1']}


I want to transform this into HTML:

<ol>
<li><a href="?a=Sun">Sun</a></li>
  <ol>
  <li><a href="?a=Sun.1">Sun.1</a></li>
    <ol>
    <li><a href="?a=Sun1.1">Sun1.1</a></li>
    <li><a href="?a=Sun1.2">Sun1.2</a></li>
    </ol>
  <li><a href="?Sun.2">Sun.2</a></li>
    <ol>
    <li><a href="?a=Sun2.1">Sun2.1</a></li>
    <li><a href="?a=Sun2.2">Sun2.2</a></li>
    </ol>
  </ol>
<li><a href="?a=Kupa">Kupa</a></li>
  <ol>
  <li><a href="?a=Kupa1">Kupa1</a></li>
  </ol>
</ol>

If the user clicks on a branch-link say 'Sun.1' then the branch below opens/closes (not printed by the servlet). Like a tree view control in an native GUI app.

Has this, or a similar approach, been done before in python ( I am using webware/cheetah)?

--
Greg
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to