PDA

View Full Version : [CLOSED] Recenter modal window on page resize



michaeld
Aug 04, 2013, 1:14 AM
Is there a way to reposition modal windows when the page is resized back to the center? I'd like to do this globally for all windows.

Daniil
Aug 05, 2013, 6:53 AM
Hi @michaeld,

I can suggest the following.

Example

<%@ Page Language="C#" %>

<%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>

<!DOCTYPE html>
<html>
<head runat="server">
<title>Ext.NET v2 Example</title>
</head>
<body>
<form runat="server">
<ext:ResourceManager runat="server">
<Listeners>
<WindowResize Handler="var win = Ext.ComponentQuery.query('window[hidden=false][modal=true]');

if (win.length > 0) {
win[0].center();
}" />
</Listeners>
</ext:ResourceManager>

<ext:Window ID="Window1" runat="server" Title="Window 1" Modal="true" />

<ext:Window ID="Window2" runat="server" Title="Window 2" Modal="true" Hidden="true" />

<ext:Button runat="server" Text="Show 1" Handler="App.Window1.show();" />

<ext:Button runat="server" Text="Show 2" Handler="App.Window2.show();" />
</form>
</body>
</html>

michaeld
Aug 08, 2013, 2:36 AM
I'll try it.