PDA

View Full Version : [CLOSED] Problem loading Window on the client



vadym.f
Jul 15, 2013, 8:02 PM
Hi,

I'd like to load a Window on the client before it's made visible. Somehow, I can't seem to be able to do it and the Window is loaded only when it's visible. Could you please let me know what's missing or incorrect in this setup?



<ext:ResourceManager ID="ResourceManager1" runat="server">
<Listeners>
<DocumentReady Handler="loadWindow();">
</DocumentReady>
</Listeners>
</ext:ResourceManager>
<ext:Window ID="Window1" runat="server" Icon="CogEdit" Title="Edit"
Width="800" Height="600" Resizable="false" Collapsible="false" Hidden="true"
Modal="true">
<Loader ID="Loader1" runat="server" AutoLoad="true" Mode="Frame" Url="">
</Loader>
</ext:Window>

<script>
var loadWindow = function () {
var wnd = App.Window1;
var url = "http://ext.net";

if (wnd) {
wnd.getLoader().load({
url: url
});
}
};
</script>

Baidaly
Jul 15, 2013, 9:49 PM
Hello!

It seems, this is not possible due to rendering logic of Window but I'll ask my colleagues.

However, you can try to load your frame into non-hidden window but outside of the browser's window and show it when it required.

vadym.f
Jul 16, 2013, 4:02 AM
Hello!

It seems, this is not possible due to rendering logic of Window but I'll ask my colleagues.

However, you can try to load your frame into non-hidden window but outside of the browser's window and show it when it required.

Thanks for the suggestions! This looks like a functional change in v.2 because the previous version would allow me to load hidden windows. I'm just trying to migrate our existing application functionality here.

Daniil
Jul 16, 2013, 6:30 AM
Hi,

As far as I can know IE can't load hidden iframes, so, I am not sure how it could work with Ext.NET v1. Could you, please, provide a v1 test case?

vadym.f
Jul 16, 2013, 12:15 PM
Hi Daniil, I've put together two very similar test cases for both versions of the framework. There's obviously some difference in Window definition semantics but other than it's close. Ext.Net v1.x loads the hidden Window fine in IE9.

Ext.Net v1.x


<%@ Page Language="C#" AutoEventWireup="true" %>
<%@ 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 1.x</title>
<ext:ResourcePlaceHolder ID="ResourcePlaceHolder1" runat="server" Mode="Script" />
<ext:ResourcePlaceHolder ID="ResourcePlaceHolder2" runat="server" Mode="Style" />
<script type="text/javascript">
var showWindow = function () {
var wnd = Ext.getCmp("Window1");
wnd.center();
wnd.setVisible(true);
};

var loadWindow = function () {
var wnd = Ext.getCmp("Window1");
var url = "http://ext.net";
wnd.load({
url: url,
callback: function () { Ext.Msg.alert("Loaded", "Window was loaded!"); },
});
};
</script>
</head>
<body>
<form id="form1" runat="server">
<ext:ResourceManager ID="ResourceManager1" runat="server">
<Listeners>
<DocumentReady Handler="loadWindow();" />
</Listeners>
</ext:ResourceManager>
<ext:Viewport ID="Viewport1" runat="server" Layout="FitLayout">
<Items>
<ext:Panel ID="Panel1" runat="server">
<BottomBar>
<ext:Toolbar ID="Toolbar1" runat="server">
<Items>
<ext:Button ID="Button1" runat="server" Text="Show Window">
<Listeners>
<Click Handler="showWindow();"></Click>
</Listeners>
</ext:Button>
</Items>
</ext:Toolbar>
</BottomBar>
</ext:Panel>
</Items>
</ext:Viewport>
<ext:Window ID="Window1" runat="server" Icon="CogEdit" Title="Edit" Width="800" Height="600"
Resizable="false" Collapsible="false" Hidden="true" Modal="true" Draggable="true">
<AutoLoad Mode="IFrame" Url="" ManuallyTriggered="true">
</AutoLoad>
</ext:Window>
</form>
</body>
</html>



Ext.Net v2.x


<%@ 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" />
<script type="text/javascript">
var showWindow = function () {
var wnd = App.Window1;
wnd.center();
wnd.setVisible(true);
};

var loadWindow = function () {
var wnd = App.Window1;
var url = "http://ext.net";
wnd.load({
url: url,
callback: function () { Ext.Msg.alert("Loaded", "Window was loaded!"); },
});
};
</script>
</head>
<body>
<form id="Form1" runat="server">
<ext:ResourceManager ID="ResourceManager1" runat="server">
<Listeners>
<DocumentReady Handler="loadWindow();" />
</Listeners>
</ext:ResourceManager>
<ext:Viewport runat="server" Layout="FitLayout">
<Items>
<ext:Panel runat="server">
<BottomBar>
<ext:Toolbar runat="server">
<Items>
<ext:Button ID="Button1" runat="server" Text="Show Window">
<Listeners>
<Click Handler="showWindow();">
</Click>
</Listeners>
</ext:Button>
</Items>
</ext:Toolbar>
</BottomBar>
</ext:Panel>
</Items>
</ext:Viewport>
<ext:Window ID="Window1" runat="server" Icon="CogEdit" Title="Edit" Width="800" Height="600"
Resizable="false" Collapsible="false" Hidden="true" Modal="true" Draggable="true">
<Loader ID="Loader1" runat="server" AutoLoad="false" Mode="Frame" Url="">
</Loader>
</ext:Window>
</form>
</body>
</html>

Daniil
Jul 16, 2013, 3:26 PM
Thank you for the clear examples.

Yes, the problem with v2 that a hidden Window doesn't render its content.

I can suggest this hack.


wnd.hidden = false;
wnd.load({
url: url,
callback: function () { Ext.Msg.alert("Loaded", "Window was loaded!"); },
});
wnd.hidden = true;

vadym.f
Jul 16, 2013, 3:37 PM
Thanks Daniil, the hack does the trick in IE9! Please mark this thread as closed.