PDA

View Full Version : Ext.Window as child of Panel



rhollencamp
29 Dec 2009, 9:04 PM
I have a panel set as the center of a viewport layout, and I am creating Ext.Windows as items in this panel (with constrain = true). However, the constrain does not function properly until the window is resized. Also, when the window is first resized, the window shadows get messed up.

The problem can be seen at http://power-user-tools.no-ip.org, but I created a smaller test case at http://power-user-tools.no-ip.org/test.html.

Much obliged for your help, thanks!

Animal
30 Dec 2009, 12:06 AM
Windows are floating and cannot be child items.

Just render the Window to the Panel's body.

Condor
30 Dec 2009, 12:54 AM
Actually, you can use windows as child items, e.g.

new Ext.Panel({
title: 'Panel',
width: 500,
height: 500,
layout: 'absolute',
items: {
xtype: 'window',
title: 'Window',
x: 100,
y: 100,
width: 200,
height: 200,
constrain: true,
initHidden: false,
shadow: false
},
renderTo: Ext.getBody()
});
(I did have to disable the shadow, because it was initially misaligned)

Animal
30 Dec 2009, 2:34 AM
Yes, in a layout: 'absolute' Container. But I'm not sure posting a working "coincidence" is a good idea. That code will be cargo culted, and people will be adding Windows to border layouts and quacking about how they don't work.

Condor
30 Dec 2009, 2:37 AM
Yes, in a layout: 'absolute' Container. But I'm not sure posting a working "coincidence" is a good idea. That code will be cargo culted, and people will be adding Windows to border layouts and quacking about how they don't work.

IIRC you posted a feature request that floating items should only be rendered but not layed out by the various layouts.

Animal
30 Dec 2009, 2:42 AM
Yes, floating: true child items could be rendered with no special layout sizing/positioning done which would make things easier for everyone.

Animal
30 Dec 2009, 2:47 AM
The proposal

http://www.extjs.com/forum/showthread.php?t=80943

The concept of getItems to gather all renderable items is already being added, so this could work.

rhollencamp
30 Dec 2009, 12:41 PM
Thanks for the help Animal, I got it working by calling win.render(Ext.getCmp('contentPanel').body);

However, the docs are a bit misleading:
To constrain a Window to another element specify renderTo.

I could not get this to work by just setting renderTo; I had to call render specifically.