PDA

View Full Version : Can a window be constrained to an element?



hworg
8 Jun 2009, 11:15 PM
hi,

can anyone tell me if its's possible to constrain a window to a given element?

basically what i want to do is have an application with a dataview down the left hand side, then have the right hand side work like an mdi window.

Animal
8 Jun 2009, 11:50 PM
Render it to the Element, and configue it constrain: true

chalu
10 Jun 2009, 2:13 PM
Since I have a related question I decided to post it here.
Can a maximizable window be constrained (when maximized) to the center region of an Ext.Viewport having a border layout, so that the maximized window does not cover the browser viewport (the entire application) :-/:-/

hendricd
10 Jun 2009, 3:29 PM
Since I have a related question I decided to post it here.
Can a maximizable window be constrained (when maximized) to the center region of an Ext.Viewport having a border layout, so that the maximized window does not cover the browser viewport (the entire application) :-/:-/

@chalu - If an Ext.Window is rendered to your center region (it's constraining container) of your border layout, it will be constrained there -- regardless of it's visual state.

If you're thinking about letting the Window free-float normally over the entire layout -- until maximized, you have a bit of work to do:

Theory:



new Ext.Window({
title : 'Title',
constrain : true,
maxTarget : myCenterRegionContainer,

maximize : function(){
if(!this.maximized &&
this.maxTarget && this.maxTarget != this.container){

this.prevContainer = this.container;
this.maxTarget.dom.appendChild(this.el);
this.container = this.maxTarget;
}
return Ext.Window.prototype.maximize.call(this);

},

restore : function(){

if(this.maximized && this.prevContainer){
this.prevContainer.dom.appendChild(this.el);
this.container = this.prevContainer;
this.prevContainer = null;
}

return Ext.Window.prototype.restore.call(this);
}

});

chalu
10 Jun 2009, 9:40 PM
Ok, will try that out. thanks