[CLOSED] 4.2 : Invalid regular expression flags error using filterHeader & Livesearch plugins

  1. #1

    [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
    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.
  2. #2
    Hello Susan Zhang!

    I see your example uses different views and a desktop with dynamic modules... So the problem is not just with a grid panel using the FilterHeader and LiveSearch plug ins, but is only reproducible when the grid is part of a desktop's dynamic module?

    I mean, in your code reduction process, did you try to reproduce it with just a plain GridPanel representing your data on a single view, and the issue didn't reproduce?
    Fabrício Murta
    Developer & Support Expert
  3. #3
    True, If user configured to open grid windows at login time, it works fine. Only those dynamicly opened windows have error.
    -szhang
  4. #4
    Hello Susan Zhang!

    Sorry for the delay, I could run your test case but I'm not getting any issue here. Actually I think only odd thing I see here is... The grid is loading only one record. But I'm sure this is something wrong with the grid reader or the provided LoadGridData() method. It returns an array of array entries if I watch client-side network traffic when loading the gridpanel (or hitting pager's refresh button).

    Other than that, absolutely no problem. You didn't specify it is necessary to interact with the page in any way, so I didn't try it at all. I suspect this might be an already fixed issue? I tested it here in our latest github sources.

    But yes, running your test case against NuGet's 4.2.0 I get the error. I'm pretty confident the bug was fixed in #1436. You should give the latest github sources a try.

    Hope this helps!
    Fabrício Murta
    Developer & Support Expert
  5. #5
    Great! that does fix the issue.
    Thanks for helps!
    -szhang
  6. #6
    Hello Susan!

    Thanks for the feedback! Glad it worked well for you!
    Fabrício Murta
    Developer & Support Expert

Similar Threads

  1. Replies: 4
    Last Post: Feb 13, 2017, 11:16 AM
  2. Block input with regular expression
    By sp00k in forum 2.x Help
    Replies: 2
    Last Post: Jun 23, 2014, 6:49 AM
  3. [CLOSED] CPU Performance problems on Regular Expression
    By andreasperanza in forum 1.x Legacy Premium Help
    Replies: 6
    Last Post: Nov 30, 2012, 3:27 PM
  4. Replies: 1
    Last Post: Nov 28, 2012, 2:55 AM
  5. editable grid and custom validation with regular expression
    By n_s_adhikari@rediffmail.com in forum 1.x Help
    Replies: 0
    Last Post: Sep 24, 2009, 5:08 PM

Posting Permissions