PDA

View Full Version : [CLOSED] ext:Window Loader Autosize



supera
Feb 16, 2012, 7:12 PM
Hi!

I am creating my Form Details as aspx pages.

I'm loading these Form Details in a ext:Window with Loader tag.


<ext:Window ID="wndDetails" runat="server" Icon="ApplicationFormEdit" Resizable="false" Hidden="true" Modal="true" Constrain="true" Width="400" Height="300">
<Loader runat="server" AutoLoad="true" Url="~/default.aspx" Mode="Frame" TriggerEvent="show" ReloadOnEvent="true">
<LoadMask Msg="Carregando..." ShowMask="true" />
<Params>
<ext:Parameter Name="ID" Value="" Mode="Value" />
</Params>
</Loader>
</ext:Window>


I wish the ext: Window automatically adjusts to itself to its contents. It's possible?

Thanks for any help!

Daniil
Feb 16, 2012, 7:48 PM
Hi,

Please use a Viewport with Layout="FitLayout" as a top level container within the ASPX page that you load into the Window. Then that Viewport will occupy a whole Window's space.

supera
Feb 17, 2012, 10:13 AM
Hi Daniil... thanks for your reply

I think the solution is not good for me.

I'll have Form Details with only two form fields and other Form Details with dozens of fields.

Alternatively, I thought I'd create a directmethod in the mainpage and call this method in formdetails where I pass the height and width.

What do you think? have a better idea?

Daniil
Feb 17, 2012, 11:50 AM
I got the requirement now.

Well, there is no such built-in functionality.

I can suggest the following solution.

Example Parent Page

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

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

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Ext.NET v2 Example</title>
</head>
<body>
<form runat="server">
<ext:ResourceManager runat="server" />
<ext:Window
ID="Window1"
runat="server"
Shadow="false">
<Loader
runat="server"
Mode="Frame"
Url="Test.aspx" />
</ext:Window>
</form>
</body>
</html>


Example Child Page

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

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

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Ext.NET v2 Example</title>
</head>
<body>
<form runat="server">
<ext:ResourceManager runat="server" />
<ext:FormPanel
runat="server"
Width="300"
DefaultAnchor="100%"
Border="false" >
<Items>
<ext:TextField runat="server" FieldLabel="TextField" />
<ext:TextField runat="server" FieldLabel="TextField" />
</Items>
<Listeners>
<AfterRender
Handler="var win = parentAutoLoadControl.target || parentAutoLoadControl, //you can use just 'parentAutoLoadControl' after update to Ext.NET v2 beta.
size = this.getSize();

size.height += 34;
size.width += 12;
win.setSize(size);"
Delay="100" />
</Listeners>
</ext:FormPanel>
</form>
</body>
</html>

supera
Feb 17, 2012, 12:27 PM
Hi Daniil!

Thanks a lot for your help! Works very fine.

Now, I need center the window in screen... New thread?

Daniil
Feb 17, 2012, 12:58 PM
It's rather a minor thing, I don't think the new thread is required.

Please use the Window's center method.

win.setSize(size);
win.center();

supera
Feb 17, 2012, 1:02 PM
Perfect!

Thanks a lot for your help!

banrisulssw
Sep 02, 2016, 1:14 PM
Hello,

This solution it works perfectly on older version of ext.net, but when i changed to the new version (4.1), stopped working, the parent window is not resizing! Would you help me? Thanks!

fabricio.murta
Sep 02, 2016, 8:50 PM
Hello @banrisulssw! Welcome to Ext.NET forums!

Would you mind creating a new thread about this problem (and probably mentioning this thread) in the appropriate 4.x forums?

banrisulssw
Sep 05, 2016, 8:07 PM
Thanks!

Yes, i opened a new thread in the 4.1 forum!