dwz dialog不出来的问题

论坛 期权论坛 脚本     
匿名技术用户   2020-12-30 05:40   11   0

一、子页面加载完毕后,动态生成<a href='#' target='dialog' ...>sadfa</a>,需要显式调用一下dwz框架的初始化dialog函数,否则不弹出窗口,而是新打开一个页面。

....

$div_planlist.html(shtml);

//!!调用dwz框架的初始化diaolog部分。

//子页面$(function)加载完毕后js生成的<a target='dialog'>,要再初始化一下。否则不出对话框

init_dialogs();


二、dwz.ui.js中修改一下代码,把function initUI(_box)中初始化dialogs的代码提出来写一个单独的函数,让外部可以单出初始化dialog:

function initUI(_box){

.....

init_dialogs();

$("div.pagination", $p).each(function(){

.....

}


function init_dialogs(_box)
{
var $p = $(_box || document);
//dialogs
//alert("a[target=dialog]=" + $("a[target=dialog]", $p).length);
$("a[target=dialog]", $p).each(function(){
$(this).click(function(event){
var $this = $(this);
//alert($this.attr("headtitle"));

var title = $this.attr("headtitle") || $this.text(); //title改为headtitle,因为与a的title提示功能冲突
var rel = $this.attr("rel") || "_blank";
var options = {};
options.aid=$this.attr("id"); //打开dialog链接的id,将来回写父窗体状态用。
var w = $this.attr("width");
var h = $this.attr("height");
if (w) options.width = w;
if (h) options.height = h;
options.max = eval($this.attr("max") || "false");
options.mask = eval($this.attr("mask") || "false");
options.maxable = eval($this.attr("maxable") || "true");
options.minable = eval($this.attr("minable") || "true");
options.fresh = eval($this.attr("fresh") || "true");
options.resizable = eval($this.attr("resizable") || "true");
options.drawable = eval($this.attr("drawable") || "true");
options.close = eval($this.attr("close") || "");
options.param = $this.attr("param") || "";

var url = unescape($this.attr("href")).replaceTmById($(event.target).parents(".unitBox:first"));
DWZ.debug(url);
if (!url.isFinishedTm()) {
alertMsg.error($this.attr("warn") || DWZ.msg("alertSelectMsg"));
return false;
}
$.pdialog.open(url, rel, title, options);

return false;
});
});
$("a[target=ajax]", $p).each(function(){
$(this).click(function(event){
var $this = $(this);
var rel = $this.attr("rel");
if (rel) {
var $rel = $("#"+rel);
$rel.loadUrl($this.attr("href"), {}, function(){
$rel.find("[layoutH]").layoutH();
});
}

event.preventDefault();
});
});
}


分享到 :
0 人收藏
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

积分:7942463
帖子:1588486
精华:0
期权论坛 期权论坛
发布
内容

下载期权论坛手机APP