PDA

View Full Version : Unable to render TreePanel in Iframe



cdeclercq
25 Mar 2010, 9:27 AM
Hello,

I have an html window A containing an iframe B.
ExtJS is loaded in A.
My javascript code is loaded in B and looks like the following :


window.Ext = parent.Ext;
Ext.applyIf(Array.prototype, window.parent.Array.prototype);
Ext.applyIf(Date.prototype, window.parent.Date.prototype);
Ext.applyIf(Function.prototype, window.parent.Function.prototype);
Ext.applyIf(Number.prototype, window.parent.Number.prototype);
Ext.applyIf(String.prototype, window.parent.String.prototype);

Ext.QuickTips.init();



var wmsRoot = new Ext.tree.AsyncTreeNode();
var Tree = Ext.tree;
var tree = new Tree.TreePanel({
animate : true,
autoScroll:true,
loader: loader,
enableDD:true,
containerScroll: true,
border: false,
width: 250,
height: 300,
root: wmsRoot
});

tree.render(document.getElementById('tree'));


The TreePanel doesn't render at all in the iframe's div (id='tree'), but if I do :


tree.render(parent.document.getElementById('parent_div'));
the TreePanel renders perfectly in the window A.

Any ideas to help me ?
If I load ExtJS in the Iframe, everything is ok, but I want to load extjs only one time an not in every iframe.

Thanks a lot,

Charlotte Declercq.