PDA

View Full Version : [SOLVED] Moving Panel does not keep buttons



mitchellsimoens
26 Aug 2009, 8:17 AM
I have 3 panels, 2 parent and 1 child panels. The child can switch between the 2 parent panels but it seems to lose it's buttons. I have created a text script that proves it:


var panel;
Ext.onReady(function() {
var bodySize = Ext.getBody().getSize(true);

var leftColumn = new Ext.Panel({
region: "west",
itemId: "leftColumn",
width: bodySize["width"]/4,
style: {
"z-index": Ext.WindowMgr.zseed - 1
}
});

var centerColumn = new Ext.Panel({
region: "center",
itemId: "centerColumn",
width: bodySize["width"]/2,
style: {
"z-index": Ext.WindowMgr.zseed - 1
}
});

var rightColumn = new Ext.Panel({
region: "east",
itemId: "rightColumn",
autoScroll: "auto",
width: bodySize["width"]/4,
style: {
"z-index": Ext.WindowMgr.zseed - 1
}
});

var vp = new Ext.Viewport({
layout: "border",
monitorResize: true,
defaults: {
frame: true
},
items: [leftColumn, centerColumn, rightColumn]
});

var test = setTimeout(function() {
panel = new Ext.Panel({
id: "randomPanel",
title: "Random Panel",
html: "just a random panel test",
buttons: [{
text: "Submit",
handler: function(){

}
},{
text: "Close",
handler: function(){

}
}]
});

leftColumn.add(panel);
leftColumn.doLayout();
}, 1000);

var test2 = setTimeout(function() {
leftColumn.remove(panel);
centerColumn.add(panel);
centerColumn.doLayout();
}, 5000);
});

even tried:


leftColumn.remove(panel, true);

Animal
26 Aug 2009, 9:30 AM
http://extjs.com/deploy/dev/docs/?class=Ext.Container&member=remove !

mitchellsimoens
26 Aug 2009, 11:18 AM
I looked and used the remove() function and it can even return the removed component but it still gets moved without the buttons.

Animal
26 Aug 2009, 11:45 AM
Did you read the part about it destroying?

mitchellsimoens
26 Aug 2009, 11:46 AM
Yes but no worries I fixed my problem so it works as I want it to.

Animal
27 Aug 2009, 2:11 AM
You added ", false" then and everything just worked?

mitchellsimoens
27 Aug 2009, 6:29 AM
yeah. I for some reason believed I knew everything and that default was true lol. Shouldn't believe I know everything but I did

Animal
27 Aug 2009, 6:48 AM
Ah.. I know how that delusion goes! ;)