PDA

View Full Version : Loading Indicator when loading IFrame



ablu
1 May 2007, 10:55 PM
Hello

I'm trying to have a loading indicator in when i'm loading a page in an iframe.
The code i have right now:


Example = function(){
var layout;
return {
init : function(){
layout = new Ext.BorderLayout(document.body, {
north: {
split:false,
initialSize: 32,
titlebar: false
},
center: {
titlebar: false,
autoScroll:true,
closeOnTab: true,
hideTabs: true
}
});

layout.beginUpdate();
layout.add('north', new Ext.ContentPanel('north', 'North'));
layout.add('center', new Ext.ContentPanel('sbProperties', 'Properties'));
layout.add('center', new Ext.ContentPanel('sbEditor', 'Editor'));
layout.add('center', new Ext.ContentPanel('sbModules', 'Modules'));
layout.getRegion('center').showPanel('sbProperties');
layout.endUpdate();
},

sbShowPanel : function(panelid){
var panel = layout.getRegion('center');
panel.showPanel(panelid);
var subpanel = panel.getPanel(panelid);
Example.addIframePanel(panelid,'Dudu', panelid+'.html');
},

addIframePanel : function(id, title, href) {
var newpanel = id+'Frame';
if (!layout.showPanel(newpanel)) {
var newiframe = new Ext.ContentPanel(newpanel, {
title: title,
closable: true,
autoCreate: true,
fitToFrame: true
});
Ext.DomHelper.append(newpanel, {
tag: 'iframe',
src: href,
width: '100%',
height: '100%',
frameborder: '0'
});
layout.add('center',newiframe);
}
}

};

}();
Ext.EventManager.onDocumentReady(Example.init, Example, true);


I think there should be placed something in the addIframePanel function, as the iframe is generated on the fly. But I dont know where to start.

Thanks for any help!

Aldo