dwz dialog不出来的问题
2013-10-14 17:03
239 查看
一、子页面加载完毕后,动态生成<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();
});
});
}
....
$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();
});
});
}
相关文章推荐
- 大整数乘法的Karatsuba算法实现
- Capistrano集群部署CloudFoundry
- android_cpu/memory/进程/线程
- Climbing Stairs [LEETCODE]
- D3.js学习(一)
- SQL Server Profiler基本使用指南【来自Aisino_BBS】
- windows XP下网络引导安装windows XP+dhcp+samba+tftp
- 组合求解--递归法
- 110404 Longest Nap
- 自动化测试工具QTP:维护对象库、获取对象属性、智能识别、参数化若干问题
- 大大
- ubuntu 10.10 上搭建 weblogic
- Add Deployment java.lang.NullPointerException
- python安装!配置环境变量,及配置变量后是否需要重启!
- 在Html中使用JavaScript的几点小结
- mysql的基本操作(初学者)
- .net中SessionState相关配置
- 输出乘法口诀
- 浏览器的加载与页面性能优化
- C#如何通过反射调用带有ref或者out的参数的方法