Jul 06, 2017, 9:22 PM
[CLOSED] Loader's params null after panel has been activated
I've had to change implementation of the AutoLoad for Loader as in the following ChangeLog's item.
71. The Panel's AutoLoad property has been removed. Use the Loader one.
It has the ComponentLoader type.
The LoadConfig class hass been removed. Use the ComponentLoader one.
71.1. Use DisableCaching instead of NoCache.
71.2. Use Mode="Html" instead of Mode="Merge". It's by default.
71.3. Use LoadMask.ShowMask instead of ShowMask.
71.4. Use LoadMask.Msg instead of MaskMsg.
71.5. Use Loader BeforeLoad and Load events instead of Panel
BeforeUpdate and Update.
71.6. Use AutoLoad instead of ManuallyTriggered.
A replacement of ManuallyTriggered="true" is AutoLoad="false".
The scenario is a card panel with three cards (panels) which the second one had an AutoLoad (Mode="IFrame") with a parameter which is being updated at the client side, this was working fine (see image below). Noticed even the 2nd panel gets activated its loader params are still persisted and can be modified at the client side.
After switching to Loader (Mode="Frame") approach although the panel gets properly activated the loader's params are now null with the following code (see image below). It seems as if the loader/panel hasn't load the parameters once activated. Once params aren't null, what's the proper way to update them now?
Also, I've been suspecting the previous AutoLoad mechanism automatically appended its parameters into the current request... is this correct? If so, can I assume the new Loader mechanism does the same or it behaves differently?
In the example provided below it shows the loader's params being overwritten at the client side upon reload.
DefaultTest.aspx
71. The Panel's AutoLoad property has been removed. Use the Loader one.
It has the ComponentLoader type.
The LoadConfig class hass been removed. Use the ComponentLoader one.
71.1. Use DisableCaching instead of NoCache.
71.2. Use Mode="Html" instead of Mode="Merge". It's by default.
71.3. Use LoadMask.ShowMask instead of ShowMask.
71.4. Use LoadMask.Msg instead of MaskMsg.
71.5. Use Loader BeforeLoad and Load events instead of Panel
BeforeUpdate and Update.
71.6. Use AutoLoad instead of ManuallyTriggered.
A replacement of ManuallyTriggered="true" is AutoLoad="false".
The scenario is a card panel with three cards (panels) which the second one had an AutoLoad (Mode="IFrame") with a parameter which is being updated at the client side, this was working fine (see image below). Noticed even the 2nd panel gets activated its loader params are still persisted and can be modified at the client side.
After switching to Loader (Mode="Frame") approach although the panel gets properly activated the loader's params are now null with the following code (see image below). It seems as if the loader/panel hasn't load the parameters once activated. Once params aren't null, what's the proper way to update them now?
Also, I've been suspecting the previous AutoLoad mechanism automatically appended its parameters into the current request... is this correct? If so, can I assume the new Loader mechanism does the same or it behaves differently?
In the example provided below it shows the loader's params being overwritten at the client side upon reload.
DefaultTest.aspx
<%@ Page Language="C#" %>
<script runat="server">
protected void Page_Load(object sender, EventArgs e)
{
if (!X.IsAjaxRequest)
{
this.Label1.Text = DateTime.Now.ToLongTimeString();
}
}
public void SetParams_AndLoad(object sender, DirectEventArgs e)
{
this.MainPanel.Loader.Params["StateAbbr"] = "CA";
this.MainPanel.Loader.Params["RandNumb"] = "1111111";
this.MainPanel.LoadContent();
ExtNet.MessageBox.Show(new MessageBoxConfig
{
Title = this.MainPanel.ID + " -- " +this.MainPanel.Loader.Url,
Message = this.MainPanel.Loader.Params["StateAbbr"] + "<br/>" + this.MainPanel.Loader.Params["RandNumb"],
Icon = MessageBox.Icon.INFO,
Buttons = MessageBox.Button.OK
});
return;
}
</script>
<!DOCTYPE html>
<html>
<head runat="server">
<script type="text/javascript">
function setParamsAndLoad() {
debugger;
App.MainPanel.loader.params.StateAbbr = "AK";
App.MainPanel.loader.params.RandNumb = "90222";
//App.MainPanel.reload();
App.MainPanel.load(App.MainPanel.loader.getConfig());
Ext.Msg.show(
{
title: App.MainPanel.id + " -- " + App.MainPanel.loader.url,
msg: App.MainPanel.loader.params.StateAbbr + "<br/>" + App.MainPanel.loader.params.RandNumb,
});
return true;
}
</script>
<title>LOADERS TEST --- Deferred Loading - Ext.NET Examples</title>
<link href="/resources/css/examples.css" rel="stylesheet" />
<style>
.msg {
border : 1px solid #999;
padding : 6px;
width : 250px;
font-weight : bold;
text-align : center;
margin-bottom : 30px;
}
.msg em {
font-style : italic;
font-weight : bold;
}
</style>
</head>
<body>
<form runat="server">
<ext:ResourceManager runat="server" />
<div class="msg x-box-mc">
Main page creation time: <em><ext:Label ID="Label1" runat="server" /></em>
</div>
<hr />
<h3>6. EPIC TEST</h3>
<ext:Panel
ID="MainPanel"
runat="server"
Title="Window"
Width="600"
Height="400">
<Loader ID="MainPanelLoader"
runat="server"
Url="Child.aspx?TestID=123"
Mode="Frame"
DisableCaching="false"
AutoLoad="true"
RemoveAll="true">
<%--Mode="Frame"--%>
<LoadMask ShowMask="true" />
<Params>
<ext:Parameter Mode="Auto" Name="StateAbbr" Value="FL" />
<ext:Parameter Mode="Auto" Name="RandNumb" Value="34567"/>
</Params>
</Loader>
</ext:Panel>
<ext:Panel id="ButtonsPanel" runat="server" Border="true" ButtonAlign="Left">
<Buttons>
<ext:Button runat="server" ID="CliButtton" Text="SetParams Client Test" Icon="ArrowRefresh" AutoPostBack="false" CausesValidation="false">
<Listeners> <Click Fn="setParamsAndLoad"></Click> </Listeners>
</ext:Button>
<ext:Button runat="server" ID="ServButtton" Text="SetParams Server Test" Icon="ArrowOut" AutoPostBack="false"
CausesValidation="false">
<DirectEvents>
<Click OnEvent="SetParams_AndLoad">
</Click>
</DirectEvents>
</ext:Button>
</Buttons>
</ext:Panel>
</form>
</body>
</html>
Child.aspx<%@ Page Language="C#" %>
<!DOCTYPE html>
<script runat="server">
protected void Page_Load(object sender, EventArgs e)
{
System.Diagnostics.Debug.WriteLine("CHILD PAGE LOAD");
}
</script>
<html>
<head runat="server">
<title>Child Page</title>
</head>
<body style="padding:10px;">
<% System.Threading.Thread.Sleep(1000); %>
Child page creation time:
<%= DateTime.Now.ToLongTimeString() %>
<p>StateAbbr PARAM = [<%= Request.Params["StateAbbr"] %>]</p>
<p>RandNumb PARAM = [ <%= Request.Params["RandNumb"] %>]</p>
<p>ABS URL = [ <%= Request.Url.AbsoluteUri%>]</p>
<p>Raw URL = [ <%= Request.RawUrl %>]</p>
</body>
</html>
Last edited by fabricio.murta; Aug 21, 2017 at 5:14 PM.