Keith M. Corbett wrote:

> This is something I want to do that, for all I know, could be easy, or
> perhaps it is very hard.

It looks pretty easy to me. More below.


> I need a tree widget, like a directory browser. The widget should
> display a tree where each node is a hyper-link that performs an action
> to browse and re-render the tree. (In HTML terms, this could be
> implemented as nested unordered lists, or alternatively as a table.)

I strongly suggest a list here. :)


> Each hyper-link represents either a branch or a terminal node, like a
> directory or a file. If the user clicks on a branch link, I want the
> widget to "open" that branch and display its children, and close
> anything that was "open" before.
>
> Associated with some nodes would be additional links that the user
> could click on to perform some other actions.
>
> Q: Using Weblocks, would it be necessary to render each of the tree
> browser links as a hyper-link to the entire page and redisplay the
> entire tree?

You never need to reload the entire page, because even if you
want to take the easy road and just re-render the tree it can
be done via AJAX.

But you don't even need to reload the tree.

First define a widget for displaying a branch node.

Clicking on a node invokes an action that toggles the state of
it. When the state changed from closed to open you just set
the currently open node to closed (keep a pointer to it in
the tree object).

Rendering behavior: a closed node just renders itself,
an open node renders itself and all of its children.

This way a maximum of two small widgets will need to be
reloaded on each click.


> Maybe I should be looking beyond Weblocks to do this?

I think Weblocks is an exceptionally good match for what you
are trying to do here.

But I'm curious, what made you think it might not?

  Leslie


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"weblocks" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/weblocks?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to