PDA

View Full Version : ext:Window position



haltenberg
Jul 28, 2008, 4:26 PM
I have an ext:Window on my page, which is not displayed on PageLoad and a bunch of user controls with buttons. When a button in user control is clicked, an iframe inside the window is updated client-side and the window is displayed (modal). Everything works fine when the page is not scrolled down. When the page is scrolled down and a button is clicked on any of the bottom user controls, I have to scroll up to see the window.

Is there anyway to make the Ext:Window show up in the centre of the screen, regardless of the scroll position (e.g. like Ext.Confirm -- it is always displayed in the centre)?

I believe the problem is that the window already exists and it's just being hidden/shown, but it doesn't know that the document scrolled down. So the question is: how do I tell the window what the new "center" is? My guess would be to create a BeforeShow listener for the window, but what do I set in the listener?

Thank you!

haltenberg
Jul 30, 2008, 12:21 PM
I have found the window.center() method in ExtJS documentation and added it to my code (client-side scripts call window.center() after window.show()). This seems to help a little, but sometimes the window is still offset (well, at least with .center() part of the window is always in the viewable zone). I wonder if the problem could be caused by the fact that the page uses table design? (header row, navigation cell, content cell, footer row; everything in content cell does not use tables inside)

Thanks!

haltenberg
Aug 13, 2008, 6:21 PM
Hm... I made a quick test and looks like table design is not the reason for wrong window placement. I ran across the following post http://extjs.com/forum/showthread.php?t=41100&highlight=window+position

Does this mean that Coolite 0.5.4 also has this problem? (window.center() does not take into account scroll position). Is this going to be fixed in 0.6?

Thanks!