PDA

View Full Version : panel.remove(item,false) => item does not disappear



maho2nd
14 Jan 2010, 3:02 AM
Hello,

I have a panel p2 which contains the panel p.
Now I like to remove panel p, but I don't want to destroy it, because I need it in another component too.

So i tried p2.remove(p, false); and doLayout but the panel p does not disappear.



var p = new Ext.Panel({
title: 'My Panel',
collapsible:true,
renderTo: 'panel-basic',
width:400,
html: Ext.example.bogusMarkup
});

// preventBodyReset: true
var p2 = new Ext.Panel({
title: 'A Panel with W3C-suggested body-html styling',
preventBodyReset: true,
renderTo: 'panel-reset-true',
width: 400,
items: p
});

p2.remove(p, false);
p2.doLayout();


Thanks.

Animal
14 Jan 2010, 3:06 AM
You need to add it to a hidden "trashcan" Container, and then call trashcan.doLayout()

Animal
14 Jan 2010, 3:11 AM
Or see if this works: http://www.extjs.com/forum/showthread.php?p=425889#post425889

Condor
14 Jan 2010, 3:38 AM
You could also use:

p2.remove(p, false);
p.hide();
(but it depends on the layout of p2 if this will work correctly)

You could also consider giving p2 a card layout and switch from p to another card.

maho2nd
14 Jan 2010, 3:54 AM
Or see if this works: http://www.extjs.com/forum/showthread.php?p=425889#post425889

Thanks! Thats exactly what i need.