PDA

View Full Version : [CLOSED] Reload window content when user loader dynamically



rthiney
Aug 27, 2013, 9:15 PM
I have a window who's contents vary, so I use the loader to load various pages. When the users resizes the window, I want to reload the contents so they re-render and conform to new size...
However, when I use the Resize listender event too #{win}.reload() it tells me that their is no URL...probably because of timing issue....what is the best way to achieve this?

vadym.f
Aug 27, 2013, 9:34 PM
Something like this might give you an idea. There may be a better and cleaner way around this problem I suspect.

Parent.aspx



<%@ 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 id="Head1" runat="server">
<title>Ext.Net 2.x</title>
<ext:ResourcePlaceHolder ID="ResourcePlaceHolder1" runat="server" Mode="Script" />
<ext:ResourcePlaceHolder ID="ResourcePlaceHolder2" runat="server" Mode="Style" />
</head>
<body>
<form id="Form1" runat="server">
<ext:ResourceManager ID="ResourceManager1" runat="server">
</ext:ResourceManager>
<ext:Viewport runat="server" Layout="FitLayout">
<Items>
<ext:Panel runat="server">
<TopBar>
<ext:Toolbar runat="server">
<Items>
<ext:Button ID="Button1" runat="server" Text="Show Window">
<Listeners>
<Click Handler="App.winEdit.show();">
</Click>
</Listeners>
</ext:Button>
</Items>
</ext:Toolbar>
</TopBar>
</ext:Panel>
</Items>
</ext:Viewport>
<ext:Window runat="server" ID="winEdit" Flex="1" Title="Editor" Hidden="true" Icon="Magnifier"
Width="500" Height="300" TitleAlign="Center" Resizable="true" ButtonAlign="Center"
Modal="true" Shadow="true" ShadowMode="Drop" AutoScroll="true">
<Loader ID="Loader1" runat="server" AutoLoad="false" Mode="Frame" Msg="Loading Editor..."
ShowMask="true" Url="Child.aspx">
</Loader>
<Listeners>
<Resize Handler="if(App.winEdit.getLoader() && App.winEdit.getLoader().url) App.winEdit.reload();">
</Resize>
</Listeners>
</ext:Window>
</form>
</body>
</html>


Child.aspx



<%@ 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 id="Head1" runat="server">
<title>Ext.Net 2.x</title>
<ext:ResourcePlaceHolder ID="ResourcePlaceHolder1" runat="server" Mode="Script" />
<ext:ResourcePlaceHolder ID="ResourcePlaceHolder2" runat="server" Mode="Style" />
</head>
<body>
<form id="Form1" runat="server">
<ext:ResourceManager ID="ResourceManager1" runat="server">
<StartupMask Message="Loading...">
</StartupMask>
</ext:ResourceManager>
<ext:Viewport runat="server" Layout="FormLayout">
<Items>
<ext:TextField runat="server" ID="TextField1" FieldLabel="Some Text">
</ext:TextField>
</Items>
</ext:Viewport>
</form>
</body>
</html>

rthiney
Aug 28, 2013, 3:14 AM
Something like this might give you an idea. There may be a better and cleaner way around this problem I suspect.

Parent.aspx



<%@ 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 id="Head1" runat="server">
<title>Ext.Net 2.x</title>
<ext:ResourcePlaceHolder ID="ResourcePlaceHolder1" runat="server" Mode="Script" />
<ext:ResourcePlaceHolder ID="ResourcePlaceHolder2" runat="server" Mode="Style" />
</head>
<body>
<form id="Form1" runat="server">
<ext:ResourceManager ID="ResourceManager1" runat="server">
</ext:ResourceManager>
<ext:Viewport runat="server" Layout="FitLayout">
<Items>
<ext:Panel runat="server">
<TopBar>
<ext:Toolbar runat="server">
<Items>
<ext:Button ID="Button1" runat="server" Text="Show Window">
<Listeners>
<Click Handler="App.winEdit.show();">
</Click>
</Listeners>
</ext:Button>
</Items>
</ext:Toolbar>
</TopBar>
</ext:Panel>
</Items>
</ext:Viewport>
<ext:Window runat="server" ID="winEdit" Flex="1" Title="Editor" Hidden="true" Icon="Magnifier"
Width="500" Height="300" TitleAlign="Center" Resizable="true" ButtonAlign="Center"
Modal="true" Shadow="true" ShadowMode="Drop" AutoScroll="true">
<Loader ID="Loader1" runat="server" AutoLoad="false" Mode="Frame" Msg="Loading Editor..."
ShowMask="true" Url="Child.aspx">
</Loader>
<Listeners>
<Resize Handler="if(App.winEdit.getLoader() && App.winEdit.getLoader().url) App.winEdit.reload();">
</Resize>
</Listeners>
</ext:Window>
</form>
</body>
</html>


Child.aspx



<%@ 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 id="Head1" runat="server">
<title>Ext.Net 2.x</title>
<ext:ResourcePlaceHolder ID="ResourcePlaceHolder1" runat="server" Mode="Script" />
<ext:ResourcePlaceHolder ID="ResourcePlaceHolder2" runat="server" Mode="Style" />
</head>
<body>
<form id="Form1" runat="server">
<ext:ResourceManager ID="ResourceManager1" runat="server">
<StartupMask Message="Loading...">
</StartupMask>
</ext:ResourceManager>
<ext:Viewport runat="server" Layout="FormLayout">
<Items>
<ext:TextField runat="server" ID="TextField1" FieldLabel="Some Text">
</ext:TextField>
</Items>
</ext:Viewport>
</form>
</body>
</html>


Hi Vadym,
App.winEdit.getLoader() && App.winEdit.getLoader().url are always null or undefined.
How can I get the URL that was loaded into a panel?


My function to load the window:


#{winEdit}.load({url:label+'.aspx',
params:{'portfolioId':#{hidPortfolioId}.getValue() ,
'documentId':#{hidDocumentId}.getValue(),
'fundId':fundId,
'y':#{hidY}.getValue(),
'q':#{hidQ}.getValue() }});


alert(#{winEdit}.getLoader().url); <-- returns null/undefined each time...




I mean, I could construct URL into var manually, and reload based on that var on resize event, but seems to me there should be a cleaner way?

Daniil
Aug 28, 2013, 5:03 AM
Hi @rthiney,

Please demonstrate the Window's configuration.

rthiney
Aug 28, 2013, 5:15 AM
Hi @rthiney,

Please demonstrate the Window's configuration.


<ext:Window runat="server" ID="winEdit" Flex="1" Title="Editor" Hidden="true" Icon="Magnifier" TitleAlign="Center" Resizable="true" ButtonAlign="Center" Modal="true" DefaultButton="SaveContentButton"
Shadow="true" ShadowMode="Drop" Maximizable="true" BodyPadding="0" BodyStyle="padding:50px" Constrain="true" >
<ConstrainToRegion />


<Loader ID="Loader1" runat="server" AutoLoad="false" Mode="Frame" RemoveAll="true">
<LoadMask Msg="Loading Editor..." ShowMask="true"></LoadMask>
</Loader>
<Listeners>
<Resize Handler=" if(currentUrl!=undefined) App.ContentPlaceHolder1_winEdit.getLoader().load(c urrentUrl); ">
</Resize>
</Listeners>
<Buttons>
<ext:Button ID="SaveContentButton" runat="server" Icon="Disk" Text="Save" Disabled="true">
<Listeners>
<Click Handler="App.ContentPlaceHolder1_winEdit.getBody().SaveCont ents.call();" />
</Listeners>
</ext:Button>
<ext:Button ID="RefreshContentButton" runat="server" Icon="Reload" Text="Refresh" Disabled="true">
<Listeners>
<Click Handler="App.ContentPlaceHolder1_winEdit.getBody().RefreshP review.call();" />
</Listeners>
</ext:Button>
<ext:Button ID="btnCa" runat="server" Icon="Decline" Text="Close">
<Listeners>
<Click Handler="#{winEdit}.close();" />
</Listeners>
</ext:Button>
</Buttons>
</ext:Window>

Daniil
Aug 28, 2013, 5:43 AM
So, at the first load you should do the following:

App.winEdit.getLoader().url = "url";
App.winEdit.reload();
on subsequent calls you could do:

App.winEdit.reload();