[OPEN] [#570] Partial view with component loader

  1. #1

    [OPEN] [#570] Partial view with component loader

    Hi,

    I am upgrading a project from 2.5 and I have an issue with loading a partial view in a window using a directevent. The same code works in 2.5 but not in 3.0. In 3.0 the partial view is loaded in the background but it is not rendered, the window stays blank.

    Thanks in advance!

    I created a simplified example:
    controller
            public ActionResult Index()
            {
                return View();
            }
    
            [DirectMethod]
            public ActionResult ButtonShowWindow()
            {
    
                //loader
                ComponentLoader WinLoader = new ComponentLoader
                {
                    Url = Url.Action("window", "Test"),
                    Scripts = true
                };
    
                //add parameter
                WinLoader.Params.Add(new Parameter("containerId", "testWindow"));
    
                //create window
                Window win = new Window
                {
                    ID = "testWindow",
                    Title = "test",
                    Height = 450,
                    Width = 550,
                    Loader = WinLoader,
                    Layout = "FitLayout"
                };
    
                win.Render(RenderMode.Auto);
    
                return this.Direct();
            }
    
            public ActionResult window(string containerId)
            {
    
                return new Ext.Net.MVC.PartialViewResult
                {
                    ContainerId = containerId,
                    RenderMode = RenderMode.AddTo
                };
            }
    Index view
    @(Html.X().ResourceManager())
    @(Html.X().Button()
            .Text("Show window")
            .DirectEvents(de =>
            {
                de.Click.Url = Url.Action("ButtonShowWindow");
            })
    )
    Window view
    @(Html.X().Panel()
        .Width(200)
        .Height(200)
        .Icon(Icon.Clock)
        .Title("Server Time")
        .Padding(10)
        .Html(DateTime.Now.ToLongTimeString())
    )
    Last edited by Daniil; Dec 21, 2014 at 1:19 PM. Reason: [OPEN] [#570]
  2. #2
    Hi @thesvr,

    Thank you for the report. It is a known Issue:
    https://github.com/extnet/Ext.NET/issues/570

    I've added a reference to this thread in the issue.

    At the moment I can suggest the following solution.

    1. Please replace
    Scripts = true
    with
    Mode = LoadMode.Script
    Result:
    ComponentLoader WinLoader = new ComponentLoader
    {
        Url = Url.Action("window"),
        Mode = LoadMode.Script
    };
    2. Please add
    WrapByScriptTag = false
    for the PartialViewResult.

    Result:
    return new Ext.Net.MVC.PartialViewResult
    {
        ContainerId = containerId,
        RenderMode = RenderMode.AddTo,
        WrapByScriptTag = false
    };
    Last edited by Daniil; Dec 22, 2015 at 8:03 AM.
  3. #3

    Any update

    I just checkt sencha change log and it seems to be fixed (EXTJS-18192 Component.load does not honour the scripts: true config).

    I am starting a migration from v2 to v3. This project uses script is true everywhere. Is there any other way how to migrate without using the proposed solution?
  4. #4
    Hello @thesvr!

    Thanks for pointing the Sencha issue!

    I could find that fix you mentioned in both ExtJS 5.1.2 changelog and ExtJS 6.0.1 changelog, so that's a fix meant to be honored (at first) in the upcoming Ext.Net 4 version.

    We will analyze if upgrading ExtJS from 5.1.1 to 5.1.2 on Ext.NET is allowed and get back to you.
    Fabrício Murta
    Developer & Support Expert

Similar Threads

  1. Replies: 7
    Last Post: Sep 12, 2014, 4:49 PM
  2. [CLOSED] Component Loader Not Working
    By PriceRightHTML5team in forum 2.x Legacy Premium Help
    Replies: 3
    Last Post: May 06, 2014, 6:43 AM
  3. [CLOSED] BUG: Component Loader with ASMX
    By amitpareek in forum 2.x Legacy Premium Help
    Replies: 9
    Last Post: Aug 14, 2013, 1:13 PM
  4. [CLOSED] reference of a control loaded by component loader
    By mirwais in forum 2.x Legacy Premium Help
    Replies: 4
    Last Post: Dec 28, 2012, 1:05 PM
  5. [CLOSED] Component Loader
    By softmachine2011 in forum 2.x Legacy Premium Help
    Replies: 13
    Last Post: Nov 13, 2012, 3:08 PM

Posting Permissions