easyui dialog iframe模式,dialog 父级页面调用子页面(iframe)的方法

var content = '<iframe id="iframe1" name="iframeuuid" src="' + url + '" width="100%" height="98%" frameborder="0" scrolling="no"></iframe>';
var div = document.createElement('div');
div.id = "sbkSelectDialog";
document.body.appendChild(div);
$('#selectDialog').dialog({
title: '选择',
width: 1000,
height: 600,
closed: false,
cache: false,
//href: url,
content:content,
modal: true,
buttons:[{
text:'保存',
iconCls:'icon-save',
handler:function(){
//获取iframe里面的内容
var childWin = document.getElementById('iframe1').contentWindow;
//调用子页面对象,子页面的方法
var rows = childWin.selectedDevListGrid.getSelectDevList();
if(rows){
if(rows.length==0){
$.messager.alert('提示','请选择需要选择的设备!');
}else{
console.log(rows);
}
}

}
},{
text:'关闭',
iconCls:'icon-close',
handler:function(){
$("#selectDialog").dialog('destroy');
}
}],
onClose : function() {
$(this).dialog('destroy');
},
onLoad:function(){

}
});

猜你喜欢

转载自www.cnblogs.com/hellonotebook/p/11087559.html
今日推荐