Apr 04, 2017, 11:01 PM
[CLOSED] 4.2 : Invalid regular expression flags error using filterHeader & Livesearch plugins
Hi, My existing code breaks after upgrade to 4.2. I managed to recreate the issue with small set of code. The code works if comment out FilterHeader & Livesearch plugins in_DataGridPanel.cshtml.
This is error I got after click "render another module":
Uncaught SyntaxError: Invalid regular expression flags
at eval (<anonymous>)
at F.executeScriptDelay (ext.axd?v=4.2.0:256)
at F.executeScript (ext.axd?v=4.2.0:256)
at F.requestSuccessHandler (ext.axd?v=4.2.0:249)
at Object.callback (ext.axd?v=4.2.0:19)
at F.onComplete (ext.axd?v=4.2.0:19)
at F.onStateChange (ext.axd?v=4.2.0:19)
at XMLHttpRequest.<anonymous> (ext.axd?v=4.2.0:19)
executeScriptDelay @ ext.axd?v=4.2.0:256
executeScript @ ext.axd?v=4.2.0:256
requestSuccessHandler @ ext.axd?v=4.2.0:249
callback @ ext.axd?v=4.2.0:19
onComplete @ ext.axd?v=4.2.0:19
onStateChange @ ext.axd?v=4.2.0:19
(anonymous) @ ext.axd?v=4.2.0:19
I am using MVC5 Ext.net4.2. Please let me know if you need more info.
Thanks for helps!
-szhang
This is error I got after click "render another module":
Uncaught SyntaxError: Invalid regular expression flags
at eval (<anonymous>)
at F.executeScriptDelay (ext.axd?v=4.2.0:256)
at F.executeScript (ext.axd?v=4.2.0:256)
at F.requestSuccessHandler (ext.axd?v=4.2.0:249)
at Object.callback (ext.axd?v=4.2.0:19)
at F.onComplete (ext.axd?v=4.2.0:19)
at F.onStateChange (ext.axd?v=4.2.0:19)
at XMLHttpRequest.<anonymous> (ext.axd?v=4.2.0:19)
executeScriptDelay @ ext.axd?v=4.2.0:256
executeScript @ ext.axd?v=4.2.0:256
requestSuccessHandler @ ext.axd?v=4.2.0:249
callback @ ext.axd?v=4.2.0:19
onComplete @ ext.axd?v=4.2.0:19
onStateChange @ ext.axd?v=4.2.0:19
(anonymous) @ ext.axd?v=4.2.0:19
I am using MVC5 Ext.net4.2. Please let me know if you need more info.
Thanks for helps!
-szhang
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using Ext.Net;
using Ext.Net.MVC;
namespace desktopTest4._2mvc.Controllers
{
public class FABHomeController : Controller
{
// GET: FABHome
public ActionResult Index()
{
return View();
}
[DirectMethod(ShowMask = true)]
public ActionResult CreateWindow()
{
var desktop = this.GetDesktop();
desktop.RemoveModule("add1-module");
return this.PartialExtView("_GridWin");
}
public ActionResult DataGridPanel()
{
return PartialView("_DataGridPanel");
}
public ActionResult LoadGridData()
{
var results = new object[]
{
new object[] { "3m Co", 71.72, 0.02, 0.03, "9/1 12:00am" },
new object[] { "Alcoa Inc", 29.01, 0.42, 1.47, "9/1 12:00am" },
new object[] { "Altria Group Inc", 83.81, 0.28, 0.34, "9/1 12:00am" },
new object[] { "American Express Company", 52.55, 0.01, 0.02, "9/1 12:00am" },
new object[] { "American International Group, Inc.", 64.13, 0.31, 0.49, "9/1 12:00am" },
new object[] { "AT&T Inc.", 31.61, -0.48, -1.54, "9/1 12:00am" },
new object[] { "Boeing Co.", 75.43, 0.53, 0.71, "9/1 12:00am" },
new object[] { "Caterpillar Inc.", 67.27, 0.92, 1.39, "9/1 12:00am" },
new object[] { "Citigroup, Inc.", 49.37, 0.02, 0.04, "9/1 12:00am" },
new object[] { "E.I. du Pont de Nemours and Company", 40.48, 0.51, 1.28, "9/1 12:00am" },
new object[] { "Exxon Mobil Corp", 68.1, -0.43, -0.64, "9/1 12:00am" },
new object[] { "General Electric Company", 34.14, -0.08, -0.23, "9/1 12:00am" },
new object[] { "General Motors Corporation", 30.27, 1.09, 3.74, "9/1 12:00am" },
new object[] { "Hewlett-Packard Co.", 36.53, -0.03, -0.08, "9/1 12:00am" },
new object[] { "Honeywell Intl Inc", 38.77, 0.05, 0.13, "9/1 12:00am" },
new object[] { "Wal-Mart Stores, Inc.", 45.45, 0.73, 1.63, "9/1 12:00am" }
};
return this.Store(results);
}
}
}
//index.cshtml
@using Ext.Net;
@using Ext.Net.MVC;
@{
Layout = null;
}
<!DOCTYPE html>
<html>
<head>
<title>Ext.NET MVC Sample</title>
</head>
<body>
@(Html.X().ResourceManager())
<header>
<a href="http://ext.net/"><img src="http://speed.ext.net/identity/extnet-logo-large.png" class="logo"/></a>
</header>
@(
Html.X().Desktop()
.Modules(
Html.X().DesktopModule()
.ModuleID("add1-module")
.Shortcut(
Html.X().DesktopShortcut()
.Name("Render another module")
.Handler("OpenGridWin();")
.TextCls("x-long-label")
)
)
.DesktopConfig(
Html.X().DesktopConfig()
.ShortcutDragSelector(true)
.ShortcutDefaults(defaults =>
{
defaults.IconCls = "x-default-shortcut";
})
)
)
<script>
window.AppRoot = '@Url.Content("~")';
var OpenGridWin = function (winId)
{
Ext.net.DirectMethod.request({
url: window.AppRoot + 'FABHome/CreateWindow',
failure: function (result) {
Ext.Msg.alert("OnGridWindoError", result);
return false;
}
});
}
</script>
</body>
</html>
//_GridWin.cshtml
@{
var X = Html.X();
}
@(
X.DesktopModuleProxy()
.Module(
Html.X().DesktopModule().ModuleID("add1-module")
.AutoRun(true)
.Launcher(
Html.X().MenuItem()
.Icon(Icon.ApplicationEdit)
)
.Window(
Html.X().Window()
.Width(500)
.Height(500)
.Layout(LayoutType.Fit)
.CloseAction(CloseAction.Destroy) //won't keep state when it is open again
.Items(
X.Panel()
.ItemsFromAction("DataGridPanel")
) // end items
)//end window
) //end module
)
//_DataGridPanel.cshtml
@{
var X = Html.X();
}
@(
Html.X().GridPanel()
.Frame(true).MultiColumnSort(true)
.Store(
X.Store().RemotePaging(false)
.Model(
X.Model()
.Fields(
new ModelField("company"),
new ModelField("price", ModelFieldType.Float),
new ModelField("change", ModelFieldType.Float),
new ModelField("pctChange", ModelFieldType.Float)
)
)
.PageSize(20)
.Proxy(
X.AjaxProxy()
.Reader(X.JsonReader().RootProperty("data").MessageProperty("message"))
.Url(Url.Action("LoadGridData"))
)
)
.ColumnModel(
Html.X().Column().Text("Company").DataIndex("company").Flex(1),
Html.X().Column().Text("Price").DataIndex("price").Renderer(RendererFormat.UsMoney),
Html.X().Column().Text("Change").DataIndex("change"),
Html.X().Column().Text("Change").DataIndex("pctChange"),
Html.X().DateColumn().Text("Last Updated").DataIndex("lastChange")
)
.TopBar(
X.Toolbar()
.Items (
X.Button()
.Text("Toggle Filter Row")
.Handler("$('.x-column-header > .x-box-inner').slideToggle();")//("var header = this.up('grid').getView().mainHd; header.setDisplayed(!header.isVisible())"),
,X.LiveSearchToolbar().HideRegExp(true).HideCaseSensitive(true).SearchFieldWidth(100)
)
)
.BottomBar(X.PagingToolbar())
.SelectionModel(X.SpreadsheetSelectionModel().RowSelect(true)) //add row number breaks grping,export,cell copy..
.View(
X.GridView()
.Listeners(ls =>
{
ls.Activate.Handler = "$('.x-column-header > .x-box-inner').slideToggle()";
})
)
.Plugins(
X.CellEditing().ClicksToEdit(1)
,X.LiveSearchGridPanel()
, X.FilterHeader().UpdateBuffer(2000) //delay checking input
)
)
Last edited by fabricio.murta; Apr 07, 2017 at 6:01 PM.