PDA

View Full Version : [CLOSED] Error on destroy ext.window IE11



RCN
Jun 18, 2014, 6:54 PM
I have a window with closeAction set to 'destroy'. When the window is closed, an exception is thrown on IE 11, as shown below:

SCRIPT5007: Unable to get value of the property 'app' object is null or undefined
File: Index2 Line: 515 Column: 9


ExampleController.cs



public class ExampleController : System.Web.Mvc.Controller
{
public ActionResult Index2()
{
FormPanel frm = new FormPanel();
frm.FieldDefaults.LabelAlign = LabelAlign.Top;

FileUploadField fuf = new FileUploadField();

Button _btnClose = new Button
{
Text = "Close"
};
_btnClose.Listeners.Click.Handler = "parentAutoLoadControl.close();";

Toolbar tbar = new Toolbar();
tbar.Items.Add(_btnClose);
frm.TopBar.Add(tbar);

ViewBag.Content = ComponentLoader.ToConfig(frm);

return View();
}

public ActionResult Index3()
{
return View();
}
}


Index2.aspx



<%@ Page Language="C#" Inherits="System.Web.Mvc.ViewPage<dynamic>" %>

<!DOCTYPE html>
<html>
<head id="Head1" runat="server">
</head>
<body>
<%--Conte?do da Aplica??o--%>
<ext:Hidden ID="_hdnContent" Text="<%# ViewBag.Content %>"
AutoDataBind="true" runat="server" />
<ext:ResourceManager ID="ResourceManager1" runat="server" />
<ext:Viewport ID="_vwp1" Layout="FitLayout" Border="false" runat="server" />
<script type="text/javascript">
Ext.onReady(function () {
App._vwp1.add(Ext.decode(App._hdnContent.value, true));

App._hdnContent.destroy();
});
</script>
</body>
</html>


Index3.aspx



<%@ Page Language="C#" Inherits="System.Web.Mvc.ViewPage<dynamic>" %>

<!DOCTYPE html>

<html>
<head runat="server">
<title>Index3</title>
</head>
<body>
<ext:ResourceManager ID="ResourceManager1" runat="server" />
<script type="text/javascript">
Ext.onReady(function () {
var wdw = new Ext.Window(
{
width: 400,
height: 400,
closable: false,
modal: true,
closeAction: "destroy",
loader: {
renderer: "frame",
url: Ext.net.ResourceMgr.resolveUrl("~/Example/Index2"),
loadMask: {
showMask: true
}
}
});

wdw.show();
});
</script>
</body>
</html>

Daniil
Jun 19, 2014, 4:28 AM
Hi Raphael,

Yes, such a scenario might causes problems and it might depend on a browser. In IE the iframe is already destroyed by the time Ext.NET/ExtJS finishes the click event.

I can suggest the following as a solution.

_btnClose.Listeners.Click.Handler = "Ext.defer(function() { parentAutoLoadControl.close(); }, 1);";