This ended up being pretty tricky. As it turns out you can use the html width attribute for the iFrame tag to set its width to 100%, however this won’t work for the height. For the height you have to set that manually, which you can do by retrieving the iframe element within the page DOM and settings its height to its parent.
var panel = Ext.create('Ext.form.Panel', { title: 'I am a Panel', layout: { align: 'center', type: 'vbox' }, flex: 1, html: '<iframe id="reportframe" width="100%" src="http://localhost/foo.html"></iframe>', }); // add the panel to some container myContainer.add(panel); myContainer.doLayout(); // size the iframe's height based on whatever the height is for its the DOM parent var iframe = document.getElementById('reportframe'); iframe.style.height = iframe.parentNode.style.height;
1 Comment
Hi jvalentino,
Above example is very helpfull to me however I’m facing issue here. I’ve panel and grid on the Extjs screen. On clicking on one column inside grid dynamically I’m opening above panel(having iframe ) inside the panel on the screen. The issue I’ve have is after saving the data inside the iframe I want to handle events of the iframe on the screen so that I can refresh the screen to reflect the changes onside the grid. I’ve call back jsp on saving of the iframe but I’m not able to capture the extjs function here in jsp so that I can collaspe this panel and refresh the screen.
Could you please provide me some assistence to resolve this issue ?
Regards,
safalk