1) You can call render at any time. Whatever nodes exist in the tree up to that point will be rendered. Nodes added later (unless via dynamic loading) will

Message 1 of 2
, Dec 15, 2009

1) You can call render at any time. Whatever nodes exist in the tree up
to that point will be rendered. Nodes added later (unless via dynamic
loading) will not be rendered (except a few exceptions such as
grandchildren of collapsed nodes). If you call render again, those
newly added nodes (after the previous render) will be rendered. In
YUI2 there are no generic rules about calling render. Since it was
developed over a long period, later components behave different (and
better) than older ones. TreeView is one of the oldest. Don't take its
behavior as a model for other components.

2) I have the feeling that you meant to have your function named
callback called instead of the one passed to the dynamic loader as an
argument. This will not happen as, within the dynamic loader, the
argument called 'callback' would hide anything but that name elsewhere
in your code.

What you want to do is to listen to the collapseComplete event (better
than collapse, since it is fired once the node is collapsed). Then,
after removing the node's children as you've done you have to set the
dynamicLoadComplete flag to false again: