PDA

View Full Version : Center window inside panel



k.janiszewski
28 Nov 2012, 12:10 PM
Hi.

I have problem with placing Ext.window inside Ext.panel. Window is not placed in center of panel, even when called center() method. When I maximize it, there is offset on the left side. Here is example:


<script type="text/javascript">

Ext.onReady(function() {
var panelPulpitu = Ext.create('Ext.panel.Panel', {
region: 'center',
border: false
});


var menu = Ext.create('Ext.panel.Panel', {
region: 'west',
border: true,
width: 200,
items: [{
xtype: 'button',
text: 'Test button',
handler: function() {
okno = Ext.create('Ext.window.Window', {
width: 500,
height: 300,
maximizable: true,
constraint: true,
renderTo: panelPulpitu.getEl()
});
okno.show();
}
}]
});


viewport = Ext.create('Ext.container.Viewport', {
layout: 'border',
border: false,
items: [menu, panelPulpitu]
});
});
</script>

How should I configure Window/Panel to work correctly? I'm using Ext 4.1

Best regards
Krzychu

mitchellsimoens
30 Nov 2012, 9:19 AM
Add the window to the panel