1
votes

I have a Panel that starts with an empty items collection. During the course of the application, it becomes necessary to add an GridPanel to the Panel. This appears to work fine.

At some other point in the application, it becomes necessary to remove the GridPanel, and add another one. I have tried several methods to clear the Panels contents, but with no joy.

Iterating through the items collection and called disable() doesn't work.

Calling items.removeAt(index) doesn't work.

Calling removeAll(true) doesn't work.

The grid stays there and is visible, still throwing all the same events. If I go through my load grid procedure, only one grid is displayed. But the requirements of the application are such that the grid should be cleared when there is a change in the criteria for the data that filled the grid.

3

3 Answers

1
votes

I believe I have solved my issue.

Calling remove(itemName, true) seems to be the trick.

Though I would be curious to any that could offer insight as to why removeAll(true) doesn't work.

0
votes

How are you adding the GridPanel? You could hide() the GridPanel in the closure that you create it and add it. Or you can try calling remove(panel) with the GridPanel object on the parent component. I think disable() doesn't hide the GridPanel as well, IIRC.

0
votes

This is what i have done for one of my ext projects

click: function () {
    var tempRef = Ext.getCmp("createPanel");

    tempRef.remove(Ext.getCmp("step2"),false);
    tempRef.doLayout();
    tempRef.update();

    tempRef.insert(1,Ext.getCmp("step1"));
    tempRef.doLayout();

    Ext.getCmp("backButton").disable();
    Ext.getCmp("backNext").enable();
}

This is code for one of my buttons.