[Zope] highlighting selected node of a dtml-tree

Mitchell L Model mlm@acm.org
Sat, 22 Sep 2001 12:40:32 -0400


Has anyone worked out a way to highlight the selected node of a 
dtml-tree?  Since trees are used as navigation mechanisms, it seems 
appropriate that clicking an item should highlight it (change it's 
background, make it bold -- whatever) and dehighlight the previous 
"selection".

I've done this with JavaScript (and seen various JavaScript tree 
widgets that do this), but since dtml-tree doesn't use JavaScript, it 
might have to regenerate the whole tree display on each click and 
generate something different for the node just clicked.  This gets 
tricky, since the usual behavior for clicking is to affect the 
display in another frame, not do something to the tree itself. 
Another possibility would be to add onclick JavaScript to each node's 
<a> tag that does something to highlight that node; presumably this 
would require adding a unique HTML name/id to each node's <a> or <td> 
tag so the JavaScript could refer to it.  Etc.