View Full Version : How to force a redraw on a TreeNode?

7 Oct 2011, 7:26 AM
I have a somewhat unusual requirement to sometimes display the root node of a Tree and sometimes not, depending upon the number of children the user has dragged onto the tree.

Since there is no way to dynamically make an invisible root node visible, this is handled by creating a brand new tree with a visible root node, and moving all the children from the old tree to the new tree.

This works fine except for one problem: the nodes from the original tree are displayed exactly as they were on the original tree and not indented for the new visible root node. It is only after a further child is added to the tree that the original nodes get redrawn correctly. I've studied the problem enough to be convinced that the problem is just that they are not redrawn-- the data structures look absolutely correct.

However, I can't figure out a way to force a redraw of the nodes. I've tried node.ui.hide() and node.ui.show(), I've tried removing one of the children and then re-appending it,

Any suggestions for how to accomplish this?

18 Oct 2011, 5:01 AM
The only way I could figure out to resolve this was by creating brand new nodes that were clones of the original nodes and then adding them to the new tree. I'm a newbie to both web development and Extjs development, so hopefully someone can figure out a better way to accomplish this than I have done, but I wanted to note at least one solution for other readers.