Jan 10, 2014, 4:00 PM
[CLOSED] ComponentLoader load event for iframe has null response. AutoLoad in 1.x has a response
Hi,
Just finding a slight difference between 1.x and 2.x.
Here is a 1.x sample that modifies the examples from the Ext.NET examples explorer to add an "update" listener:
In the 2.x version of this code, I find the response is always null:
For the moment I can use "loader.getTarget().getComponent(0).getEl().do m" to get the iframe from within the load event handler, unless there is a more optimal way to do this that I have missed?
Thanks!
Just finding a slight difference between 1.x and 2.x.
Here is a 1.x sample that modifies the examples from the Ext.NET examples explorer to add an "update" listener:
<%@ Page Language="C#" %>
<script runat="server">
protected void Page_Load(object sender, EventArgs e)
{
var win = new Window
{
ID = "Window1",
Title = "Ext.NET",
Width = Unit.Pixel(800),
Height = Unit.Pixel(600),
Modal = true,
Collapsible = true,
Maximizable = true,
Hidden = true
};
win.AutoLoad.Url = "http://www.ext.net";
win.AutoLoad.Mode = LoadMode.IFrame;
win.Listeners.Update.Fn = "onWindowUpdate";
win.Render(Form);
}
</script>
<!DOCTYPE html>
<html>
<head runat="server">
<title>Load External Website into Window - Ext.NET Examples</title>
<script>
function onWindowUpdate(win, response) {
console.log(response.iframe);
}
</script>
</head>
<body>
<form runat="server">
<ext:ResourceManager runat="server" />
<ext:Button runat="server" Text="Show Window" Icon="Application">
<Listeners>
<Click Handler="#{Window1}.show(this);" />
</Listeners>
</ext:Button>
</form>
</body>
</html>
Notice, I am able to get "response.iframe" successfully.In the 2.x version of this code, I find the response is always null:
<%@ Page Language="C#" %>
<script runat="server">
protected void Page_Load(object sender, EventArgs e)
{
var win = new Window()
{
ID = "Window1",
Title = "Ext.NET",
Width = Unit.Pixel(800),
Height = Unit.Pixel(600),
Modal = true,
AutoRender = false,
Collapsible = true,
Hidden = true,
Loader = new ComponentLoader
{
Url = "http://www.ext.net",
Mode = LoadMode.Frame,
LoadMask =
{
ShowMask = true
},
Listeners =
{
Load = { Fn = "onLoad" }
}
}
};
Form.Controls.Add(win);
}
</script>
<!DOCTYPE html>
<html>
<head runat="server">
<title>Load External Website into Window - Ext.NET Examples</title>
<script>
function onLoad(loader, response) {
console.log(response, loader.getTarget().getComponent(0).getEl());
}
</script>
</head>
<body>
<form runat="server">
<ext:ResourceManager runat="server" />
<ext:Button runat="server" Text="Show Window" Icon="Application">
<Listeners>
<Click Handler="#{Window1}.show(this);" />
</Listeners>
</ext:Button>
</form>
</body>
</html>
Looking at the Ext.NET code, in componentloader.js, I notice in the "afterIFrameLoad" method this:this.fireEvent("load", this, null, options);
Would it be possible to pass the response (assuming a similar "iframe" property would exist on it as in 1.x)? From what I can see the response object has two properties when it is an iframe: "iframe" and "url".For the moment I can use "loader.getTarget().getComponent(0).getEl().do m" to get the iframe from within the load event handler, unless there is a more optimal way to do this that I have missed?
Thanks!
Last edited by Daniil; Jan 13, 2014 at 2:48 PM.
Reason: [CLOSED]