views:

153

answers:

1

I have been using the following snippet of code in my app to drive a menu that contains different trees depending upon what is selected. It tries to create tree panels only once and to then reuse them if they are selected again, i.e. to keep the trees expanded state.

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;
        }

//... code to add create and add a new tree panel

The problem is with west.removeAll(false), the false stops the nodes getting destroyed but they do not appear back in the panel. The panel gets sticks to showing what it last had in it.

Using west.removeAll(true) works fine except for the fact that new panels are always created.

A: 

Should not statement be west.removeAll(true);

Natkeeran
did you read the question all the way to the end?
Neil Foley