The official release of Ext.NET Mobile is now available. Ext.NET Mobile is an ASP.NET component framework for building Phone and Tablet specific mobile web applications. Read More

[FIXED] [#1436] [4.2.1] .Icon & .UI will cause "Invalid regular expression flags" error in browser

  1. #1

    [FIXED] [#1436] [4.2.1] .Icon & .UI will cause "Invalid regular expression flags" error in browser

    When we use .UI & .Button under Ext.NET 4.2.0, the browser will have "Invalid regular expression flags" error.

    Click image for larger version. 

Name:	2017-02-09 11_22_37-Developer Tools - http___localhost_57511_.png 
Views:	3 
Size:	17.6 KB 
ID:	24843


    We have checked the response data of partial view request. the error message should be caused from this line.(url data is not single quoted)

    {script:"Ext.net.ResourceMgr.registerIcon([\"Add\",\"Delete\",\"Disk\"]);
    Ext.net.ResourceMgr.load([{url:\"/Scripts/Settings/MIBrandModelMgmt.js\"},
    {url:/uipack/aria/extui-aria-all-css3-embedded-css/ext.axd?v=4.2.0,mode:\"css\"}],
     function(){Ext.ComponentManager.onAvailable(\"ContientPanel\",function(){Ext.net.addTo(\"ContientPanel\",
    our view codes
    @using ResMgmt.Helpers;
    @model ResMgmt.Models.BrandModelModel
    @{
        MvcResourceManager.RegisterGlobalScript("~/Scripts/Settings/MIBrandModelMgmt.js");
        ViewBag.Title = "廠牌型號設定";
        var X = Html.X();
    
        var gpItemSet = X.GridPanel()
            .ID("PanelItemSetGrid")
            .AnchorHorizontal("80%")
            .Title("廠牌列表")
            .Region(Region.West)
            .Width(300)
            .Split(true)
            .ForceFit(true)
            .TopBar(
                X.Toolbar()
                    .Items(
                        X.Button()
                            .Text("新增")
                            .Icon(Icon.Add)
                            .Width(80)
                            .UI(UI.Success)
                            .Handler("handlerMIBrandModelMgmt.onCreate();"),
                        X.Button()
                            .Text("刪除")
                            .Icon(Icon.Delete)
                            .Width(80)
                            .UI(UI.Success)
                            .Handler("handlerMIBrandModelMgmt.onDelete();"),
                        X.Button()
                            .Text("儲存")
                            .Icon(Icon.Disk)
                            .Width(80)
                            .UI(UI.Success)
                            .Handler("handlerMIBrandModelMgmt.onSave();")
                )
            )
            .BottomBar(
                X.PagingToolbar()
                    .HideRefresh(true)
            );
    
    
    }
    
    @(
        X.Panel()
            .ID("PanelBrandModelMgmt")
            .Closable(true)
            .AutoScroll(true)
            .Defaults(new Parameter("Margin", 10))
            .Title("通信器材廠牌型號設定")
            .Layout(LayoutType.Fit)
            .Items(
                X.Container()
                    .Layout(LayoutType.Border)
                    .Defaults(new Parameter("Margin", 5))
                    .Items(
                        gpItemSet
                    )
            )
    )
    our partial view action codes
    public ActionResult MIBrandModelMgmt(string containerId)
            {
                var result = new Ext.Net.MVC.PartialViewResult
                {
                    ViewName = "MIBrandModelMgmt",
                    ContainerId = containerId,
                    RenderMode = RenderMode.AddTo
                };
    
                BrandModelModel model = new BrandModelModel();
    
                model.EquipTypes = _uom.IrCodes
                    .GetEquipTypes()
                    .ToList()
                    .Select(c => new CodeModel(c))
                    .ToList();
                result.Model = model;
    
                Ext.Net.X.GetCmp<TabPanel>(containerId).SetLastTabAsActive();
    
                return result;
            }

    Ted
    Last edited by fabricio.murta; Feb 09, 2017 at 6:37 PM.
  2. #2
    Hello Ted!

    Thanks for reporting the problem! We've just created issue #1436 to track and fix this!

    As an workaround please add this script tag to your main view:

    <script type="text/javascript">
        Ext.define('Ext.net.DirectEvent', {
            override: 'Ext.net.DirectEvent',
            executeScript: function (o, result, response) {
                var delay = 0,
                    em = o.eventMask || {};
    
                if (em.minDelay) {
                    delay = em.minDelay;
                }
    
                if (delay > 0) {
                    var task = new Ext.util.DelayedTask(this.executeScriptDelay, o.scope, [o, result, response]).delay(delay);
                } else {
                    if (Ext.net.Version == "4.2.0" && result.script && result.script.length > 1) {
                        result.script = result.script.replace(/([^a-zA-Z]url:)([^",}]+)/g, function (match, ref1, ref2) { return ref1 + '"' + ref2 + '"' });
                    }
    
                    this.executeScriptDelay.call(o.scope, o, result, response);
                }
            }
        });
    </script>
    It will wrap the url in quotes whenever it happens to show up in a script response.

    When we fix this issue at server-side we'll post an update here! Shouldn't take long to fix, but the fix will only be available on the sources until next public release.
  3. #3
    Hello again!

    We have just fixed the issue in latest Ext.NET sources available on github! The problem should no longer happen and the override provided wouldn't be necessary at all.
    Fabrício Murta
    Developer & Support Expert
  4. #4

    The way to access Github or fixed release?

    Fabricio,

    Thanks for your support and the fixing but we cannot find the way to access Github?
  5. #5
    Hello @u8621011!

    You might have received these instructions on the emails about the Premium license acquisition, if you can't find it, please email us at support@ext.net and we'll be able to set up or update your github access to the code repository!

    Hope this helps!
    Fabrício Murta
    Developer & Support Expert

Similar Threads

  1. Replies: 8
    Last Post: Aug 11, 2015, 2:52 PM
  2. Replies: 6
    Last Post: Feb 26, 2015, 1:49 PM
  3. Replies: 0
    Last Post: Mar 13, 2014, 5:34 AM
  4. Replies: 3
    Last Post: Mar 22, 2012, 8:46 AM
  5. [CLOSED] TreePanel : "invalid property id" error
    By coleg123 in forum 1.x Premium Help
    Replies: 5
    Last Post: Jul 23, 2011, 10:47 PM

Posting Permissions

Subscribe now to get the latest Ext.NET happenings in our newsletter.