(function ($) {
var $parent = parent.$;
//获取弹出窗口数据集合
function getDialogs() {
var dialogs = $parent("#div_index_data").data("dialogs");
dialogs = dialogs || [];
if ($.util.isEmptyObjectOrNull(dialogs))
return [];
return dialogs;
}

//获取当前弹出窗口数据
function getCurrentDialog() {
var dialogs = getDialogs();
return dialogs[dialogs.length - 1] || {};
}

//获取当前弹出窗口Id
function getCurrentDialogId() {
return getCurrentDialog().id;
}

//添加弹出窗口数据,包括弹出窗口Id和jQuery对象
function addDialog(id) {
var data = getDialogs();
data.push({ id: id, caller: window });
$parent("#div_index_data").data("dialogs", data);
}

//移除当前弹出窗口数据
function removeCurrentDialog() {
var dialogs = getDialogs();
dialogs.pop();
}

//树形操作
$.easyui.dialog = function () {
return {
//添加弹出框
addDialog: function (id) {
addDialog(id);
return getCurrentDialog();
},
//获取原调用者window对象
getCaller: function () {
return getCurrentDialog().caller;
},
//获取原调用者jQuery对象
getCaller$: function () {
return getCurrentDialog().caller.$;
},
//获取弹出窗window对象
getCurrent: function () {
var dialogId = getCurrentDialogId();
return top.frames[dialogId + "_iframe"] ? (!top.frames[dialogId + "_iframe"].contentWindow ? top.frames[dialogId + "_iframe"] : top.frames[dialogId + "_iframe"].contentWindow) : top.contentWindow;
},
//获取弹出窗jQuery对象
getCurrent$: function () {
var dialogId = getCurrentDialogId();
return top.frames[dialogId + "_iframe"] ? (!top.frames[dialogId + "_iframe"].contentWindow ? top.frames[dialogId + "_iframe"].$ : top.frames[dialogId + "_iframe"].contentWindow.$) : top.contentWindow.$;
},
//打开弹出窗口
open: function (options) {
/// <summary>
/// 弹出模态窗,解决在Iframe中无法全屏遮罩,
/// 注意:仅支持url弹窗
/// </summary>
/// <param name="options" type="Object">
/// 1. title:标题
/// 2. url:网址
/// 3. buttons:显示在窗口底部的按钮区域div的id
/// 4. icon:图标class
/// 5. width:宽度
/// 6. height:高度
/// 7. onInit:初始化事件,返回false跳出执行
/// </param>
initOptions();
if (!options.onInit(options))
return;
var dialog = createDialow();
show();
addDialog(options.id);

//初始化参数
function initOptions() {
options = $.extend({
id: $.util.newGuid(""),
title: '',
url: '',
icon: 'icon-standard-common-window',
width: 600,
height: 360,
iframe: true,
closed: false,
maximizable: true,
resizable: true,
cache: false,
modal: true,
buttons: '',
onInit: function () {
return true;
},
closeCallback: function () { }
}, options || {});
}

//创建窗口div
function createDialow() {
if (options.iframe) {
return $parent("<div id='" + options.id + "' style='overflow:visible;'><iframe id='" + options.id + "_iframe' scrolling=\"auto\" frameborder=\"0\" style=\"width:100%;height:100%;\" src='" + options.url + "' ></iframe></div>").appendTo('body');
} else {
return $parent("<div id='" + options.id + "'></div>").appendTo('body');
}
}

//弹出窗口
function show() {
dialog.dialog({
title: options.title,
href: options.iframe ? "" : options.url,
width: options.width,
height: options.height,
closed: options.closed,
maximizable: options.maximizable,
resizable: options.resizable,
cache: options.cache,
modal: options.modal,
iconCls: options.icon,
buttons: options.buttons,
border: false,
onLoad: function () {
},
onClose: function () {
options.closeCallback();
$parent("#" + getCurrentDialogId()).dialog('destroy');
removeCurrentDialog();
}
});
}
},
openCommon: function (url, title, width, height, callBack) {
$.easyui.dialog.open({
title: title,
url: url,
width: width,
height: height,
buttons: [{
text: '确定',
iconCls: 'icon-standard-common-ok',
handler: function () {
callBack(getCurrentDialogId());
}
}, {
text: '取消',
iconCls: 'icon-standard-common-cancel',
handler: function () {
$.easyui.dialog.close();
}
}]
});
},
//关闭弹出窗口
close: function () {
var dialogId = getCurrentDialogId();
if (!dialogId)
return;
$parent('#' + dialogId).dialog('close');
},
//打开Tab页面
openTab: function (tabid, url, name, img) {
addDialog("tabs_iframe_" + tabid);
AddTabMenu(tabid, url, name, img, true, true, true);
},
//关闭当前Tab页面
closeTab: function () {
removeCurrentDialog();
ThisCloseTab();
}
}
}();
})(jQuery);

easyui.dialog.js的更多相关文章

  1. Easyui dialog中嵌入iframe

    如果easyui dialog的地址属性用href超链接,easyui 不会加载整个url页面,只会截取url目标页的body体间的html, 如果想加载把其他页面 加载进dialog的iframe中 ...

  2. EASYUI Dialog的基本使用

    1.基本使用 代码: <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server&q ...

  3. easyui dialog 中嵌入html页面

    最近使用easyui比较多,这个插件确实很好用.在使用时也遇到了大大小小的问题,好在都一一解决了. 记录一下今天遇到的问题. 目的:用easyui的dialog嵌入一个html页面(html中仍有要执 ...

  4. easyUI dialog打开对话框,显示列表数据,选取一条数据操作后赋值给父窗口 resultMap声明为全局,生成getset方法

    <%@ page language="java" import="java.util.*" pageEncoding="UTF-8" ...

  5. Easyui dialog Y轴滚动条定位

    使用Easyui dialog进行数据新增的时候,如果Y轴方向有滚动条,当关闭之前的时候,将滚动条拉到最下方,再次打开的时候,滚动条还是定位在最下方. 需求: 每次打开的时候dialog Y轴滚动条定 ...

  6. jquery.util.easyui.dialog

    (function ($) { var $parent = parent.$; //获取弹出窗口数据集合 function getDialogs() { var dialogs = $parent(& ...

  7. easyui dialog 中 panel-body 高度太小出现 滚动条 的原因

    easyui dialog 中 panel-body 高度太小出现 滚动条 的原因: dialog 高度比 iframe 高度大79 就可以了 $.editcompanypersoninfo = fu ...

  8. 窗口-EasyUI Window 窗口、EasyUI Dialog 对话框、EasyUI Messager 消息框

    EasyUI Window 窗口 扩展自 $.fn.panel.defaults.通过 $.fn.window.defaults 重写默认的 defaults. 窗口(window)是一个浮动的.可拖 ...

  9. 在easyUI开发中,出现jquery.easyui.min.js函数库问题

    easyUI是jquery的一个插件,是民间的插件.easyUI使用起来很方便,里面有网页制作的最重要的三大方块:javascript代码.html代码和Css样式.我们在导入easyUI库后,可以直 ...

随机推荐

  1. 转: codereview工具之 review board 选型与实践

    转:ReviewBoard代码评审实践总结 http://my.oschina.net/donhui/blog/350074 svn与review board 结合实践 http://my.oschi ...

  2. windows下创建vp9的VS版本

    1. webm官网   下载版本: http://code.google.com/p/webm/downloads/list 创建过程这里有比较详细的英文说明: http://www.webmproj ...

  3. swift基础语法之控件使用02

    //第一个控制器:显示基础控件 import UIKit class ViewController: UIViewController { var label: UILabel = UILabel() ...

  4. C#秘密武器之异步编程

    一.概述 1.什么是异步? 异步操作通常用于执行完成时间可能较长的任务,如打开大文件.连接远程计算机或查询数据库.异步操作在主应用程序线程以外的线程中执行.应用程序调用方法异步执行某个操作时,应用程序 ...

  5. WebDriver API——第1部分

    The API definitions in this chapter shows the absolute location of classes. However the recommended ...

  6. Protocol Informatics (PI项目)【基于网络轨迹的协议逆向工程文献学习】

    Protocol Informatics[基于网络轨迹的协议逆向工程文献学习]by tsy 声明: 1)本报告由博客园bitpeach撰写,版权所有,免费转载,请注明出处,并请勿作商业用途.恕作者著作 ...

  7. BEGINNING SHAREPOINT&#174; 2013 DEVELOPMENT 第2章节--SharePoint 2013 App 模型概览 总结

    BEGINNING SHAREPOINT® 2013 DEVELOPMENT 第2章节--SharePoint 2013 App 模型概览 总结         SharePoint Apps这三个新 ...

  8. PlayMaker 不支持过渡条件

    Unity Animator 自带也支持过渡条件,  我看了下PlayMaker没有这个概念.  最近研究下PlayMaker,图形化编程的确很爽. 但是PlayMaker 始于与给一些策划进行流程设 ...

  9. IOT表

    以前在接触索引的时候,就想过要是表字段太少,索引效果不是很不好吗,直接用索引不是更直接吗?后来因为懒惰也没有去查找相关资料.正好今天看到了table organization index,看了一下,实 ...

  10. vue TypeError: Cannot read property 'length' of undefined 问题解决思路

    上图中是我在接手一个项目的时候,出现的一个关于数组的 bug,但是从上图来看,其实报错是不清楚的,只能从报错信息上看出来是 /src/page/waybill/waybill_form.vue 这个 ...