Tree not properly updating after call to setChildrenAllowed() on container

Hi,

I’ve implemented a Lazy Loading Tree backed by a Hierarchical container. The tree tracks users; and what customer/account/location they are assigned to:

Now, in my tree, certain locations can be empty, initially (meaning no user has been assigned to that location). In order to give users an indication of what they can drill down into; I’m calling setChildrenAllowed() with either true or false depending on whether a given node has children as this will show or hide the “expand node” icon.

However, because the tree also supports drag and drop, it’s possible to drag a user from one location to another location that previously had no users. Or, vice verse, drag the LAST user out of a location so that it now has none.

At that point, I need to call setChildrenAllowed(true/false) to indicate this node now has children (or no longer has them).

If I drag a user into a previously empty location, I call setChildrenAllowed(true) and the tree correctly starts to display the expand icon and the user is under that node.

However, if I now drag the user OUT; I call setChildrenAllowed(false)… the user is moved… but the empty node still shows the expand icon.

I’ve double-checked that the call to setChildrenAllowed(false) is returning true; and it is; so from the perspective of the container, the node is correctly getting switched; but it’s as if the tree “remembers” that a given node previously could have children…

So how do you show/hide the expand icon based on user interaction if this doesn’t work?

Please ignore this post; I found I had a bug which was preventing the expand arrow from getting hidden.

Do you paste your code of tree?

i have a problem, only see two levels of tree!!

i hope you can help me.