使用Modal Dialog应用模式的注意事项

  现有window open的方式 应用Modal Dialog后的方式
一般写法 window.open('url','target','feature') window.showModalDialog('url',window,'feature')
建议写法实例(已经在main.js里封装好了) OW('$customerModule.setTarget("addCustomer.vm")','addCustomer','yes'); OW('$customerModule.setTarget("addCustomer.vm")','modal');
取得父窗口的对象 opener dialogArguments
实例 window.opener.childsubmit(); dialogArguments.childsubmit();
注意事项  

1、ModalDialog里再弹开窗口,不能用open,一定要用showModalDialog
2、ModalDialog里如果提交表单会默认开新窗口,请在<head>和</head>之间加入<base target="_self">来防止

3、ModalDialog会缓存内容,所以建议在ModalDialog装载的页面<head>和</head>之间加入缓存控制:
 <META Http-Equiv="Cache-Control" Content="no-cache">
 <META Http-Equiv="Pragma" Content="no-cache">
 <META Http-Equiv="Expires" Content="0">或者直接在url后面带上?time=当前时间值的方式
4、ModalDialog里不能用按钮点击触发location.href改变当前内容,可以用一个隐藏的链接,然后再触发这个链接来切换页面。如:
 <a id="editLink" href="$contactpersonModule.setTarget("editPerson.vm")?id=$contactPerson.cid" style="display:none">编辑</a>
 <input name="edit" type="button" class="button" value="编辑" onClick="javascript:document.all('editLink').click();">

Posted on 2008-10-24 12:39  hesen  阅读(398)  评论(0编辑  收藏  举报