zeke
zeke

Reputation: 3663

ExtJS 4.2 - Constrained window is not positioned correctly after maximizing and then restoring

I have a window inside a panel with constrainHeader:true and maximizable:true. I'm using ExtJS 4.2.1.883. When the window is maximized, it expands to fill the panel as expected. When the window is restored, however, it does not return to it's previous position and is instead positioned slightly higher than expected.

See jsFiddle here.

To reproduce, click the 'add window' button, maximize the window, and then restore it. I expect that this issue is due to the header and/or toolbar but am not sure how to accommodate for that.

Upvotes: 0

Views: 978

Answers (2)

zeke
zeke

Reputation: 3663

I ended up just overriding the maximize method for Ext.window.Window. There's a line where the window calculates the position it should be restored to. I changed that as follows:

//me.restorePos = me.getPosition(true);
me.restorePos = me.getPosition();

From the docs:

getPosition( [local] ) : Number[] Gets the current XY position of the component's underlying element.

Available since: 4.0.0

Parameters local : Boolean (optional) If true the element's left and top are returned instead of page XY.

Defaults to: false

This may cause different issues in some situations, but I have not noticed any problems in my application so I'm going with it for now. Updated jsFiddle with full override here.

Upvotes: 0

dbrin
dbrin

Reputation: 15673

I believe this is a bug with recalculating the size of the containing box. Every time you maximize and restore it shifts the window up by the height of the toolbar of the containing panel.

Oh and a confirmed bug case here: http://www.sencha.com/forum/showthread.php?266726

Upvotes: 1

Related Questions