PDA

View Full Version : BorderLayout resize problem



Daniels
9 Jul 2010, 10:18 AM
I'm trying to resize a Panel in a north region of BorderLayout. The Panel is resized, but the center region doesn't refresh to get your new size, so my north Panel isn't fully showed on Window. Here's the code to simulate the problem:


Ext.onReady(function() {

var btn = new Ext.Button({
title : 'Panel 1',
xtype : "button",
text : "Resize",
height : 20,
region : "north"
});

btn.on('click', function() {
this.setHeight(100);
}, btn);

var window = new Ext.Window({
layout : "border",
height : 300,
width : 300,
defaults : {
frame : true,
},
items : [btn,{
title : 'Panel 2',
height : 100,
width : 100,
region : "center"
}]
});
window.show();
});Anyone knows how to solve it?

Animal
9 Jul 2010, 10:27 AM
You have to ask the Container to re layout its child items. doLayout

BTW, you are not resizing a Panel. You are resizing the Button. The Button is the north region if you read your code.