[CLOSED] Loader with Html renderer and Window rendering

Page 4 of 4 FirstFirst ... 234
  1. #31
    Before updating I tried to add the override but window content doesn't load:

    <%@ Page Language="C#" %>
    
    <%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
    
    <script runat="server">
        protected void Page_Load(object sender, EventArgs e)
        {
            Window win = new Window()
            {
                ID = "Window1",
                Title = "Ext.NET",
                Width = Unit.Pixel(1000),
                Height = Unit.Pixel(600),
                Modal = true,
                AutoRender = false,
                Collapsible = true,
                Maximizable = true,
                Hidden = true,
                Loader = new ComponentLoader
                {
                    DisableCaching = false,
                    Url = "http://www.ext.net",
                    // Url = "http://10.0.0.61/ReportServer?%2fRegolamento+Unico+CRM+-+WEB&rs:Command=Render&rs:Format=PDF&GruppoTicket=2515",
                    Mode = LoadMode.Frame,
                    LoadMask =
                    {
                        ShowMask = true
                    }
                }
            };
    
            this.Form.Controls.Add(win);
        }
    </script>
    
    <!DOCTYPE html>
    
    <html>
    <head id="Head1" runat="server">
        <title>Load External Website into Window - Ext.NET Examples</title>
        <link href="/resources/css/examples.css" rel="stylesheet" />
    
    
        <script type="text/javascript" >
    
            Ext.net.ComponentLoader.override({
                loadFrame: function (options) {
                    options = Ext.apply({}, options);
    
                    var me = this,
                target = me.target,
                mask = Ext.isDefined(options.loadMask) ? options.loadMask : me.loadMask,
                monitorComplete = Ext.isDefined(options.monitorComplete) ? options.monitorComplete : me.monitorComplete,
                disableCaching = Ext.isDefined(options.disableCaching) ? options.disableCaching : me.disableCaching,
                disableCachingParam = options.disableCachingParam || "_dc",
                params = Ext.apply({}, options.params),
                callback = options.callback || me.callback,
                scope = options.scope || me.scope || me;
    
                    Ext.applyIf(params, me.params);
                    Ext.apply(params, me.baseParams);
    
                    Ext.applyIf(options, {
                        url: me.url
                    });
    
                    Ext.apply(options, {
                        mask: mask,
                        monitorComplete: monitorComplete,
                        disableCaching: disableCaching,
                        params: params,
                        callback: callback,
                        scope: scope
                    });
    
                    this.lastOptions = options;
    
                    if (!options.url) {
                        throw 'No URL specified';
                    }
    
                    if (me.fireEvent('beforeload', me, options) === false) {
                        return;
                    }
    
                    var url = options.url;
    
                    if (disableCaching !== false) {
                        url = url + ((url.indexOf("?") > -1) ? "&" : "?") + disableCachingParam + "=" + new Date().getTime();
                    }
    
                    if (!Ext.Object.isEmpty(params)) {
                        var p = {};
                        for (var key in params) {
                            var ov = params[key];
    
                            if (typeof ov == "function") {
                                p[key] = ov.call(target);
                            } else {
                                p[key] = ov;
                            }
                        }
    
                        p = Ext.urlEncode(p);
                        url = url + ((url.indexOf("?") > -1) ? "&" : "?") + p;
                    }
    
                    if (mask) {
                        me.addMask(mask);
                    }
    
                    if (Ext.isEmpty(target.iframe)) {
                        var iframeObj = {
                            tag: "iframe",
                            id: target.id + "_IFrame",
                            name: target.id + "_IFrame",
                            src: url,
                            frameborder: 0
                        },
                layout = target.getLayout();
    
                        if (!target.layout || target.layout.type !== "fit") {
                            target.setLayout(Ext.layout.Layout.create("fit"));
                        }
    
                        target.removeAll(true);
    
                        var p = target,
                    iframeCt = {
                        xtype: "component",
                        autoEl: iframeObj,
                        listeners: {
                            afterrender: function () {
                                var owner = this.ownerCt;
                                owner.iframe = this.el;
    
                                if (monitorComplete) {
                                    owner.getLoader().startIframeMonitoring();
                                } else {
                                    this.el.on("load", owner.getLoader().afterIFrameLoad, owner.getLoader());
                                }
    
                                owner.getLoader().beforeIFrameLoad(options);
                            }
                        }
                    };
    
                        target.add(iframeCt);
                    } else {
                        target.iframe.dom.src = Ext.String.format("java{0}", "script:false");
    
                        try {
                            window.frames[target.iframe.dom.name].location.replace(url);
                        } catch (e) {
                            target.iframe.dom.src = url;  // IE9 refresh iframe with pdf issue: http://forums.ext.net/showthread.php?24690
                        }
    
                        this.beforeIFrameLoad(options);
                    }
    
                    if (!this.destroyIframeOnUnload) {
                        this.destroyIframeOnUnload = true;
                    }
                }
            });
    
    
        </script>
    
    
    </head>
    <body>
        <form id="Form1" runat="server">
            <ext:ResourceManager ID="ResourceManager1" runat="server" />
            
            <h1>Load External Website into an &lt;ext:Window></h1>
    
            <p>Load an external url into a Window using the AutoLoad property. 
                All Properties for the &lt;ext:Window> are set during the Page_Load Event.</p>
    
            <ext:Button ID="Button1" runat="server" Text="Show Window" Icon="Application">
                <Listeners>
                    <Click Handler="#{Window1}.show(this);" />
                </Listeners>
            </ext:Button>
        </form>
    </body>
    </html>
  2. #32
    Your test case works fine for me.
  3. #33
    I updated from SVN 2.1 and it works now .
    I thought updating was alternative to overriding.
    You can mark as closed.
    Thank you very much.
    M
  4. #34
    Yes, it was supposed to be so. Initially, I tested it with the v2.2 release. It worked.

    Now I tested with the v2.1 release (which you, probably, used before the update) and were able to reproduce the error. To avoid that error, this:
    if (!Ext.Object.isEmpty(params)) {
    should be replaced with
    if (!Ext.isEmptyObj(params)) {
Page 4 of 4 FirstFirst ... 234

Similar Threads

  1. [CLOSED] ext:Window Loader Autosize
    By supera in forum 2.x Legacy Premium Help
    Replies: 9
    Last Post: Sep 05, 2016, 7:07 PM
  2. Replies: 5
    Last Post: May 18, 2012, 1:41 PM
  3. [CLOSED] Rendering html in a user control
    By fordprefect in forum 1.x Legacy Premium Help
    Replies: 4
    Last Post: Mar 14, 2012, 7:42 PM
  4. [CLOSED] Getting the parameter defined in ext:Window Loader
    By supera in forum 2.x Legacy Premium Help
    Replies: 5
    Last Post: Feb 17, 2012, 1:27 PM
  5. Replies: 1
    Last Post: May 28, 2010, 1:13 PM

Tags for this Thread

Posting Permissions