PDA

View Full Version : Ext.window.Window && constrain && maximize



Ex_Soft
4 Oct 2012, 1:10 PM
I'm trying to constrain a window


Ext.onReady(function() {
Ext.QuickTips.init();

Ext.create("Ext.container.Viewport", {
layout: "border",
items: [{
region: "west",
layout: {
type: "vbox",
align: "stretch"
},
width: 100,
items: [{
xtype: "button",
text: "create",
handler: function(btn, e) {
var
regionCenter = btn.up("viewport").getLayout().centerRegion;

Ext.create("Ext.window.Window", {
autoShow: true,
constrain: true,
constrainTo: regionCenter.getEl(),
renderTo: regionCenter.getEl(),
title: "test",
closeable: true,
maximizable: true,
height: 200,
width: 200,
html: "html"
});
}
}]
}, {
region: "center",
id: "regionCenter",
html: "html"
}]
});
});

But when a window is being maximized:


maximize: function() {
var me = this;

if (!me.maximized) {
me.expand(false);
if (!me.hasSavedRestore) {
me.restoreSize = me.getSize();
me.restorePos = me.getPosition(true);
}
if (me.maximizable) {
me.tools.maximize.hide();
me.tools.restore.show();
}
me.maximized = true;
me.el.disableShadow();

if (me.dd) {
me.dd.disable();
}
if (me.resizer) {
me.resizer.disable();
}
if (me.collapseTool) {
me.collapseTool.hide();
}
me.el.addCls(Ext.baseCSSPrefix + 'window-maximized');
me.container.addCls(Ext.baseCSSPrefix + 'window-maximized-ct');

me.syncMonitorWindowResize();
me.fitContainer();
me.fireEvent('maximize', me);
}
return me;
}

floatParent in


fitContainer: function() {
var me = this,
parent = me.floatParent,
container = parent ? parent.getTargetEl() : me.container;

me.setSize(container.getViewSize(false));
me.setPosition.apply(me, parent ? [0, 0] : container.getXY());
}

is undefined so result of container.getXY() is passed to setPosition.
What should I configure yet?

http://jsfiddle.net/saQyR/

P.S. BTW, when a window has moved to top-left corner maximize works properly

mitchellsimoens
10 Oct 2012, 9:22 AM
What Ext JS version are you using?

Ex_Soft
12 Oct 2012, 9:55 AM
What Ext JS version are you using?
4.1.1