easyui dialog parent page and child page value

-----------------Parent Page-------------------

//url: window calling address, title: window title, width: width, height: height, shadow: whether to display the background shadow mask

function showMessageDialog(url,id, title, width, height, shadow) {

var content = '<iframe src="' + url + '" width="100%" height="99%" frameborder="0" scrolling="no"></iframe>';

var boarddiv = '<div id="'+id+'" title="' + title + '"></div>'//style="overflow:hidden;" can remove the scroll bar

$(document.body).append(boarddiv);

var win = $ ('#' + id) .dialog ({

content: content,

width: width,

height: height,

modal: shadow,

title: title,

onClose: function () {

$(this).dialog('destroy');//Events that can be closed later

},

buttons:[{

text:"OK",

handler:function(){

                                      //Call the sub page easyui dialog 

window.top.reload_dataList.call();

$("#"+id).dialog("close");

}

},{

text:"Cancel",

handler:function(){

$("#"+id).dialog("close");

}

}]

});

win.dialog('open');

}

 

 

 

--------------------Subpage--------------

 

window.top["reload_dataList"]=function(){

var rows = $('#dataGrid').datagrid('getSelections');

var listname = '';

var id = '';

for(var i=0; i<rows.length; i++){

id=rows[i].id;

listname=rows[i].listname;

}

      //pass value to parent page

$(window.parent.$("#datalistId").val(id));

$(window.parent.$("#datalistName").val(listname));

console.log("id:"+id+"listname:"+listname)

};

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326457564&siteId=291194637