[CLOSED] [#675] ComponentLoader loading component with plugins

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1

    [CLOSED] [#675] ComponentLoader loading component with plugins

    Hi,

    I am struggling to use ComponentLoader when the component has plugins.

    Here is a sample text page:

    <%@ Page Language="C#" %>
    
    <!DOCTYPE html>
    <html lang="en">
        <head runat="server">
            <title>Component loader view MVC Controller</title>
        </head>
        <body>
            <ext:ResourceManager runat="server" />
            
            <ext:Panel runat="server" Width="400" Height="400" Layout="fit">
                <Loader Mode="Component" Url="~/Loader/PanelContent">
                    <AjaxOptions Method="POST" />
                    <LoadMask ShowMask="true" />
                </Loader>
            </ext:Panel>
        </body>
    </html>
    Here is an example of an MVC Controller that works

    public class LoaderController : Controller
    {
        public ActionResult PanelContent()
        {
            return Json(ComponentLoader.ToConfig(new Panel
            {
                Title = "Panel with random plugin",
                Html = "Some content"
            }));
        }
    }
    The above works fine (for me, if I added some icon to the Icon property it doesn't show up, but I can live with that - it might be related to a separate thread we are tracking about modules/handlers etc, which I still need to look into). The main thing for me is that the AJAX response is like this (in its raw form according to the browser console)

    "[{html:\"Some content\",xtype:\"panel\",title:\"Panel with random plugin\"}]"

    Now, if I try to add any random plugin, I get a problem:

    public class LoaderController : Controller
    {
        public ActionResult PanelContent()
        {
            return Json(ComponentLoader.ToConfig(new Panel
            {
                Title = "Panel with random plugin",
                Html = "Some content",
                Plugins =
                {
                    new ClearButton()
                }
            }));
        }
    }
    With the above, all is the same, except the addition of a plugins configuration. Now, the response returns with HTTP 200 (ok), but nothing is rendered on the screen.

    Notice in this case the JSON response is quite different with various escape characters etc (unencoded/raw)

    (I have replaced the value of the webresource.axd querystring with [snip] just for clarity

    "{\u0027x.res\u0027:{res:[{url:\"/WebResource.axd?d=[snip]\u0026amp;t=635574427442910000\"}]},config:\"[{html:\\\"Some content\\\",plugins:[{ptype:\\\"clearbutton\\\"}],xtype:\\\"panel\\\",title:\\\"Panel with random plugin\\\"}]\"}"

    The first character (\u0027x) is unicode for apostrophe. And then further along is a number of not just single escaped quotes, \" but with double slashes, \\" etc.

    I see some overloads for the ToConfig method but I am not clear how to use the overloads that take a component prerenderer as I could not see any uses of those in the Ext.NET code or examples (unless I missed it). And I am not clear if I am meant to use those overrides or not. I would expect I just call ToConfig as I am doing right now.

    The only alternative I can see to this is to use a DirectMethod (which I normally do instead) but it would be nice to get ComponentLoader to work.

    Any suggestions to what I am missing here?
    Last edited by Daniil; Feb 04, 2015 at 11:32 AM. Reason: [CLOSED]

Similar Threads

  1. ComponentLoader and Explicit Id
    By ETICS in forum 2.x Help
    Replies: 0
    Last Post: Jun 26, 2013, 4:21 PM
  2. Replies: 5
    Last Post: May 17, 2013, 4:54 PM
  3. [CLOSED] Generated Code (loading plugins)
    By peter.campbell in forum 1.x Legacy Premium Help
    Replies: 5
    Last Post: Mar 21, 2013, 11:52 AM
  4. [CLOSED] ComponentLoader inconsistency
    By RCN in forum 2.x Legacy Premium Help
    Replies: 10
    Last Post: Jun 07, 2012, 12:24 PM
  5. [CLOSED] Mask delay and when component is ready loading?
    By state in forum 1.x Legacy Premium Help
    Replies: 2
    Last Post: Jul 15, 2009, 6:59 PM

Posting Permissions