Например, я использую этот макет:
Ext.layout.AbsoluteCenterLayout = Ext.extend(Ext.layout.ContainerLayout, {
monitorResize:true,
onLayout : function(ct, target){
Ext.layout.AbsoluteCenterLayout.superclass.onLayout.call(this, ct, target);
if(!this.container.collapsed){
var sz = (Ext.isIE6 && Ext.isStrict && target.dom == document.body) ? target.getViewSize() : target.getStyleSize();
this.setItemSize(this.activeItem || ct.items.itemAt(0), sz);
}
},
setItemSize : function(item, size){
if(item && size.height > 0){ // display none?
formEl = item.getEl();
var widthCenter = (size.width/2)-(formEl.getWidth()/2);
var heightCenter = (size.height/2)-(formEl.getHeight()/2);
formEl.setStyle({
left: widthCenter+'px',
top: heightCenter+'px',
position: 'absolute',
});
}
}
});
Ext.Container.LAYOUTS['absolutecenter'] = Ext.layout.AbsoluteCenterLayout;
Моя форма:
Viewport = new Ext.Viewport({
renderTo: Ext.getBody(),
layout: 'border',
items: [{
region: 'center',
xtype: 'panel',
layout: 'absolutecenter',
baseCls: 'x-plain',
items:[{
id: 'form',
formId: 'admin-loginform',
xtype: 'form',
title: 'Authentication',
iconCls: 'admin-wnd-authentication',
frame: true,
autoHeight: true,
width: 270,
defaultType: 'textfield',
labelAlign: 'right',
...