I use the following code snippet in my application to manage a menu that contains different trees depending on which one is selected. He tries to create tree panels only once and then reuse them if they are selected again, i.e. Maintain the state of extended trees.
var west = Ext.getCmp("west-panel");
west.removeAll(false);
west.doLayout();
var existingPanel = Ext.getCmp('component-tree-project-' + systemId);
if (existingPanel) {
west.add(existingPanel);
west.doLayout();
return;
}
The problem is west.removeAll (false), false stops the destruction of nodes, but they do not appear in the panel. The panel adheres to showing what was the last in it.
Using west.removeAll (true) works fine, except that new panels are always created.
source
share