PDA

View Full Version : Dialog with iframe



dcave555
26 Mar 2007, 12:01 AM
Hello all
i am trying to create dialog that have iframe with other html page.

my code is :

var dialog;
function ShowDialog()
{

var toggleTheme = function(){
Ext.get(document.body, true).toggleClass('ytheme-gray');
};

if(!dialog){
dialog=new Ext.BasicDialog('container',{
autoCreate:{
tag:'div',
cls:'x-dlg',
children:[
{
tag:'div',
cls:'x-dlg-hd'
},
{
tag:'iframe',
cls:'x-dlg-bd',
src:"fmNewCompany.htm",
frameborder: 0,
name: 'dialogFrame',
id:'dialogFrame'
},
{
tag:'div',
cls:'x-dlg-ft'
}
]
},
height:520,
width:550,
shadow: true,
modal: true,
draggable:true,
fixedcenter:true
});
dialog.addKeyListener(27, dialog.hide, dialog);
dialog.addButton('Submit', dialog.hide, dialog);
dialog.addButton('Close', dialog.hide, dialog);
}
dialog.show();
}

i can see the dialog but i can't see iframe with my page.

Please help me

thx

dcave555
27 Mar 2007, 1:52 AM
i fount solution in case someone will need:

function ShowDialog(frameaddress, dialogTitle)
{

var toggleTheme = function(){
Ext.get(document.body, true).toggleClass('ytheme-gray');
};

//create template with iframe
var template = new Ext.Template(
'<iframe id="centerFrame" name="centerFrame" frameborder="no" style="border:0px none;" scrolling="no" src="' + frameaddress + '" width="100%", height="100%"></iframe>'
);

var center;

//Create Dialog
if(!dialog){
dialog=new Ext.LayoutDialog('container',{
autoCreate: true,
closable: true,
syncHeightBeforeShow: true,
modal: true,
width: 500,
height: 550,
fixedcenter: true,
shadow: true,
resizable: false,
proxyDrag: true,
title: dialogTitle,
center: {autoScroll:false}
});
dialog.addKeyListener(27, dialog.hide, dialog);
dialog.addButton('Close', dialog.hide, dialog);

var layout = dialog.getLayout();
layout.beginUpdate();
center = layout.add('center', new Ext.ContentPanel('dialogCenter', {autoCreate: true, fitToFrame:true, closable: false}));

layout.endUpdate();
var centerEl = center.getEl();
template.overwrite(centerEl.dom, {});
}
dialog.show();
}

dubiousdavid
3 Nov 2007, 1:18 PM
Thanks so much for this. Exactly what I was searching for!