PDA

View Full Version : Creating window from iframe in different versions, setting height correctly



savsw
16 Oct 2015, 2:25 AM
Here is a code:



function resizeIframe(obj)
{
obj.style.height = obj.contentWindow.document.body.scrollHeight + 'px';
}
var someCfg = {
...
layout:'fit',
width: 800,
border: false,
modal: true,
resizable: false,
html:'<iframe id="someId" src="somePath" frameBorder="0" style="width: 100%; height: 100%;" scrolling="no" onload="javascript:resizeIframe(this);"></iframe>',
...
}


new Ext.Window(someCfg).show();

In ExtJs 3 everything works fine. The correct height of iframe is calculated, the modal window displays correctly.


But in ExtJs 4 and ExtJs 5 versions, the size of the window is always the same = 150px (in Chrome)


How can this be resolved? I can set statically the height property:



var someCfg = {
...


height: 700;
}
But the content in the source can vary, the height is changed, so it's not a good solution.

jdkhamba
16 Oct 2015, 4:07 PM
Instead of setting the height and width instead you could try setting the maxHeight and maxWdith configs. Although I am curious why would you need an iframe at all?

savsw
19 Oct 2015, 6:33 AM
Instead of setting the height and width instead you could try setting the maxHeight and maxWdith configs. Although I am curious why would you need an iframe at all?

In our application different versions of Ext Js are used on different pages. Using iframe let's to use concrete Ext Js version for concrete feature.