tags:

views:

19

answers:

2

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.

A: 

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.

Jonathan Bates
A: 

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.

Kenny Peng
I was adding via `grid.items.add(itemName, new Ext.grid.GridPanel(...`, but as I said, I did get it to work with `remove(itemName, true)`.
Jonathan Bates