PDA

View Full Version : [OPEN] [#221] Store in Partial View Raises JS Error for Destroy



cleve
Apr 29, 2013, 6:22 AM
Hi

Applying second click of the following aspx raises JS error (screenshot attached).
Please check.

(index.aspx)


<%@ Page Language="C#" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<body id="theBody">
<ext:ResourceManager runat="server" />
<ext:Container runat="server" ID="c" />
<ext:Button runat="server" Text="Inject (apply second click)">
<DirectEvents>
<Click Url="/test.aspx/test" />
</DirectEvents>
</ext:Button>
</body>
</html>


(control.ascx)


<%@ Control Language="C#" %>
<ext:Window runat="server" ID="win">
<Bin>
<ext:Store runat="server" ID="ds" AutoLoad="false">
<Model>
<ext:Model runat="server">
<Fields>
<ext:ModelField Name="newId" />
</Fields>
</ext:Model>
</Model>
<Proxy>
<ext:AjaxProxy Url="/test.aspx/getstore">
<ActionMethods Read="POST" />
<Reader>
<ext:JsonReader Root="data" TotalProperty="total" MessageProperty="message" />
</Reader>
</ext:AjaxProxy>
</Proxy>
</ext:Store>
</Bin>
<Buttons>
<ext:Button runat="server" Text="Close">
<Listeners>
<Click Handler="#{win}.close();" />
</Listeners>
</ext:Button>
</Buttons>
</ext:Window>


(controller "test")



public ActionResult Index()
{
return View(@"~/test/index.aspx");
}


public ActionResult Test(string id)
{
Ext.Net.MVC.PartialViewResult r = this.PartialExtView("~/test/control.ascx");
return r;
}

Daniil
Apr 29, 2013, 8:00 AM
Hi @cleve,

Thank you for the report. We are investigating a possible fix.

For now please use the following fix. You should place it into the page's <head>.

Fix

Ext.destroy = function () {
var ln = arguments.length,
i, arg;

for (i = 0; i < ln; i++) {
arg = arguments[i];
if (arg) {
if (Ext.isArray(arg)) {
this.destroy.apply(this, arg);
} else if (Ext.isFunction(arg.destroyStore)) {
arg.destroyStore();
} else if (Ext.isFunction(arg.destroy)) {
arg.destroy();
} else if (arg.dom) {
arg.remove();
}
}
}
};

Daniil
Apr 30, 2013, 4:30 AM
It has been fixed in SVN, you can remove a temporary fix that I suggested.

Anyway, I reported to Sencha.
http://www.sencha.com/forum/showthread.php?262480

And they opened a bug ticket.

If they fix it, we can review our fix. Created an Issue to monitor.
https://github.com/extnet/Ext.NET/issues/221