PDA

View Full Version : Closing a Ext.Window in a parent frame



chris85
10 Oct 2012, 1:33 AM
In my website I'm having an Ext Window with a iframe content. (Window Code below). Is there a way to close this window from inside this iframe? A "parent.window.close()" closes the hole website off cause. Is there a way to address the "win" object or call a function from inside this frame?



var win = new Ext.Window({
title : "My Application",
width : 500,
height: 300,
layout : 'fit',
items : [
{
xtype : "component",
autoEl : {
tag : "iframe",
src : "/myapplication/start.asp"
}
}
]
}).show();

vietits
10 Oct 2012, 2:01 AM
Try this:


Ext.onReady(function(){
window.win = new Ext.Window({
title : "My Application",
width : 500,
height: 300,
layout : 'fit',
items : [{
xtype : "component",
autoEl : {
tag : "iframe",
src : "iframe.html"
}
}]
}).show();
});

iframe.html


<html>
<head>
<script type="text/javascript">
function closeWin(){
parent.win.close();
}
</script>
</head>
<body>
<div onclick="closeWin()">Close</div>
</body>
</html>