Extjs 4: Create an iFrame Window

neolaser picture neolaser · May 17, 2011 · Viewed 45.2k times · Source

I am in need of creating an iFrame Window in Extjs. Previously in ExtJS 3.x I would do this:

bodyCfg: {
    tag: 'iframe'
}

But the Window Class of ExtJS 4 seems not to have a bodyCfg.

Any ideas on how to make an iFrame ExtJS 4 Window?

Answer

Egy Mohammad Erdin picture Egy Mohammad Erdin · May 17, 2011

I think autoEl is what you are looking for...

Some advice from me, in Ext 4.x don't use autoEl as a window config property, it can make your window malformed.. I suggest you to use autoEl in a component (items of your window)

new Ext.Window({
    title : "iframe",
    width : 300,
    height: 300,
    layout : 'fit',
    items : [{
        xtype : "component",
        autoEl : {
            tag : "iframe",
            src : "http://www.yahoo.com"
        }
    }]
}).show();

The code above is better than

new Ext.Window({
    title : "iframe",
    width : 300,
    height: 300,
    layout : 'fit',
    autoEl : {
       tag : "iframe",
       src : "http://www.yahoo.com"
    }
}).show();

Note: currenty you can't load Google and Facebook inside an iframe