View Full Version : Add/Remove Panels

30 Dec 2010, 1:59 AM
Just a quick question about adding and removing panels from a container. I have a combo box which when I select an item it adds the relevant panel to the container. The problem is that I can show all these panels once, but when selected a second time, they dont replace the current panel.

Any ideas?

30 Dec 2010, 2:05 AM
When you remove a panel it is destroyed, so you can't add it again.

I recommend using a container with layout:'card' and instead of adding/removing panels, just select the appropriate card.

30 Dec 2010, 2:06 AM
Ah ok that sounds like a much better idea.

I had set autoDestroy to false, so i thought it wouldnt be destroyed?

30 Dec 2010, 2:10 AM
Yes, it won't get destroyed, but it also won't get removed from the DOM (only from the container). If you use autoDestroy:false then you need to move the DOM of a removed component somewhere else yourself.

30 Dec 2010, 3:00 AM
For some reason when my button isnt showing up on my form when I display the panel? is there anything wrong with this?

new Ext.Button({
xtype: 'button',
text: 'Create Bar Chart',
style: {marginTop: '5px'}

30 Dec 2010, 3:34 AM
You are now using a layout:'card' container? In that case you might need to configure it with: