PDA

View Full Version : Iframe in tab - fault on tab close



ext.Will
10 Jul 2010, 1:29 PM
Hello all.
I'm having a hard time figuring this one out. I'm using ext3.2.0
I have a simple set of tabs. The first tab is not closable, but all subsequent tabs are. I have a routine that adds a new tab to the tabpanel and allows it to be closable. I am loading an iframe in that tab to load the pdf. Everything goes fine up to this point and tabs can be created with separate iframes in them, no problem. But, when you start closing the tabs the browser crashes hard when the last tab that has an iframe is closed. It doesn't matter if you create one tab with an iframe, or a bunch. It's only when you get to the last tab that is closable, and close it, will the browser crash. Now, I have set the url in the iframe, as a test, to always be http://www.google.com and everything is fine in that you can create a bunch of tabs and then close them all and there is no problem whatsoever. It's only when i'm loading a PDF on the url. I'm wondering if this is an Acrobat issue possibly? Anyone else loading PDF documents inside a tab and doing it some other way than my approach? Anywho, below are the pertinent snippets of my code where the tabs are created and managed. Oh, I have also tried using the miframe addon and setting xtype:iframepanel in each new tab and I get the same exact behavior.





var viewporttabs = new Ext.TabPanel({
xtype: 'tabpanel',
renderTo:'centertabs',
resizeTabs:true,
id: 'viewporttabsid',
tabWidth:135,
activeTab: 0,
minTabWidth:50,
enableTabScroll:true,
defaults: {autoScroll:true},
plugins: new Ext.ux.TabCloseMenu()
});


...

xtype: 'panel',
region: 'center',
margins: '0 0 0 0',
id: 'c-centerregion',
layout: 'fit',
items: [viewporttabs],
....


// first, create the first tab which is never closable
addviewporttabzero();





function addviewporttabzero(){
viewporttabs.add({
id: 'tabzero',
title: 'Page Viewer',
iconCls: 'tabs',
contentEl: 'centerregion',
closeable:false
}).show();
}


// function to create a new closable tab loading a PDF via an iframe
function openPDF()
{
var theurl = currentpdfpage; // ex: http://www.xxxxx.com/020110/test.pdf
var iframebody = '<iframe width=100% height=100% src='+theurl+'></iframe>';

theid = pdftabcounter++;

var tabs = Ext.getCmp('viewporttabsid');
if (tabs)
{
tabs.add({
id: theid,
loadMask:true,
title: url,
iconCls: 'tabs',
html: iframebody,
autoDestroy: true,
closable: true
}).show();
}
}