AI智能
改变未来

easyUI-dialog 和 iframe 套用(iframe加载页面控制dialog所在页面方法)


说明:

前端点击事件触发弹出dialog;
dialog内内容套用iframe加载单独的jsp页面;
单独jsp逻辑走动控制dialog所在页面的逻辑。
定义dialog所在页面:father
定义dialog载入页面:son
定义controller:controller

father.jsp

<div id=\"dialogDiv\"><iframe id=\"dialogIframe\" height=\"100%\" width=\"100%\" frameborder=\"0\" scrolling=\"no\" /></div>

father.js

$(function(){$(\"#dialogDiv\").dialog({title:\"标题\",//标题width: 980,//宽度height: 450,//高度top: 30,closed: true,//初始关闭cache: false,//缓存modal: true,onClose: function() {$(\"#dialogIframe\").attr(\"src\",\"\");}});}//触发运行$(\"#dialogIframeWorkOrder\").attr(\"src\",_affairsContext+\"/affMeetingNotice/addMeetingNotice?docId=\"+docId);$(\'#dialogDivWorkOrder\').dialog(\'open\');function closeDialogDiv(){//类如设置个关闭dialog$(\"#dialogDiv\").dialog(\'close\');}

controller.java

@RequestMapping(\"/affMeetingNotice/addMeetingNotice\")@ResponseBodypublic ModelAndView addMeetingNotice(HttpServletRequest request){ModelAndView view = new ModelAndView();try {view.setViewName(\"/meeting/affMeetingNotice/儿子\");} catch (Exception e) {ErrorPage.setpage(view, e);}return view;}

son.js

//触发了父亲.js里的 closeDialogDiv方法window.parent.closeDialogDiv();
赞(0) 打赏
未经允许不得转载:爱站程序员基地 » easyUI-dialog 和 iframe 套用(iframe加载页面控制dialog所在页面方法)