//selectOne ztree编辑时只能选择一项
$("a[target=ztreeEditSelectOne]", $p).each(function() {
$(this).click(function(event) {
var $this = $(this);
var title = $this.attr("title") || $this.text();
var rel = $this.attr("rel") || "ids";
var targetType = $this.attr("targetType");
var ids = "";
var $box = targetType == "dialog" ? $.pdialog.getCurrent() : navTab.getCurrentPanel();
//这里要根据你使用ztree的id查找ztree对象
var zTree = $.fn.zTree.getZTreeObj("treeDemo"),
nodes = zTree.getCheckedNodes(true), v = "";
var dept = "";
for (var i = 0, l = nodes.length; i < l; i++) {
v += nodes[i].name + ",";
dept += nodes[i].id + ",";
}
if (v.length > 0) {
v = v.substring(0, v.length - 1);
dept = dept.substring(0, dept.length - 1);
}
ids = dept;
if (!ids) {
alertMsg.error($this.attr("warn") || DWZ.msg("alertSelectMsg"));
return false;
}
if (ids.indexOf(',') != -1) {
alertMsg.error($this.attr("warn") || DWZ.msg("alertSelectMsg"));
return false;
}
var options = {};
var w = $this.attr("width");
var h = $this.attr("height");
if (w) options.width = w;
if (h) options.height = h;
//options.max = eval_r($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 = ($this.attr("href")).replaceTmById($(event.target).parents(".unitBox:first"));
url = url + "&ids=" + ids;
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=ztreeDelAjaxTodo]", $p).each(function() {
$(this).click(function(event) {
var $this = $(this);
var title = $this.attr("title") || $this.text();
var rel = $this.attr("rel") || "ids";
var targetType = $this.attr("targetType");
var ids = "";
var $box = targetType == "dialog" ? $.pdialog.getCurrent() : navTab.getCurrentPanel();
//这里要根据你使用ztree的id查找ztree对象
var zTree = $.fn.zTree.getZTreeObj("treeDemo"),
nodes = zTree.getCheckedNodes(true), v = "";
var dept = "";
for (var i = 0, l = nodes.length; i < l; i++) {
v += nodes[i].name + ",";
dept += nodes[i].id + ",";
}
if (v.length > 0) {
v = v.substring(0, v.length - 1);
dept = dept.substring(0, dept.length - 1);
}
ids = dept;
// if (!ids) {
// alertMsg.error($this.attr("warn") || DWZ.msg("alertSelectMsg"));
// return false;
// }
// if (ids.indexOf(',') != -1) {
// alertMsg.error($this.attr("warn") || DWZ.msg("alertSelectMsg"));
// return false;
// }
var options = {};
var w = $this.attr("width");
var h = $this.attr("height");
if (w) options.width = w;
if (h) options.height = h;
//options.max = eval_r($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 = ($this.attr("href")).replaceTmById($(event.target).parents(".unitBox:first"));
url = url + "&ids=" + ids;
var title = $this.attr("title");
if (title) {
alertMsg.confirm(title, {
okCall: function() {
ajaxTodo(url, $this.attr("callback"));
}
});
} else {
ajaxTodo(url, $this.attr("callback"));
}
event.preventDefault();
// DWZ.debug(url);
// if (!url.isFinishedTm()) {
// alertMsg.error($this.attr("warn") || DWZ.msg("alertSelectMsg"));
// return false;
// }
// //(url, rel, title, options);
// ajaxTodo(url, $this.attr("callback"));
//return false;
});
})
DWZ与ZTREE整合实例
4星 · 超过85%的资源 需积分: 31 133 浏览量
2013-05-31
09:21:21
上传
评论 1
收藏 6KB ZIP 举报
windsummer
- 粉丝: 2
- 资源: 5
- 1
- 2
- 3
- 4
- 5
- 6
前往页