[Project_owners] Easiest way to save/restore <tree/> state?

Eric H. Jung grimholtz at yahoo.com
Mon Feb 6 12:53:42 EST 2006


I have a number of template-driven, RDF-based <tree/> elements. They do
not specify 'dont-build-content'. I haven't found a way to
"automatically" save and restore the open/closed state of tree
containers, so unless someone can suggest one to me, I'm going to code
it manually.

My question is: what's the best way to maintain the list of open/closed
containers in an RDF file given that containers can be deleted and
moved? I was thinking of storing the subject of each open container in
a click callback:

tree.addEventListener("click", clickListener, true);
function clickListener(event) {
  if (event.detail == 1) {
    var row = {}, col = {}, childElt = {};
      .getCellAt(event.clientX, event.clientY, row, col, childElt);
    if (childElt.value == "twisty" && row.value > -1) {
      // TODO: save open/close state

Any other ideas?

Thank you,
Eric Jung

More information about the Project_owners mailing list