OpenAuth.Net/OpenAuth.Mvc/Views/ModuleManager/LookupMulti.cshtml
2015-11-26 00:18:13 +08:00

85 lines
2.4 KiB
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

@*
选择多个模块ID以ids的形式返回
*@
@model dynamic
@{
ViewBag.Title = "title";
Layout = null;
}
<div class="bjui-pageContent">
<div style="float: left; width: 100%; height: 240px; overflow: auto;" class="table table-bordered">
<ul id="lookupTree" class="ztree"></ul>
</div>
</div>
<div class="bjui-pageFooter">
<ul>
<li><button type="button" class="btn-close" data-icon="close">关闭</button></li>
<li>
<a href="javascript:;" id="btnSelected" data-toggle="lookupback"
data-args=""
class="btn btn-blue" title="选择本项" data-icon="check">选择</a>
</li>
</ul>
</div>
<script type="text/javascript">
$(document).ready(function () {
Init();
});
function Init() {
var setting = {
view: {
selectedMulti: false
},
check: {
enable: true,
chkStyle: "checkbox"
},
data: {
key: {
name: 'Name',
title: 'Name'
},
simpleData: {
enable: true,
idKey: 'Id',
pIdKey: 'ParentId',
rootPId: 'null'
}
},
callback: {
onClick: zTreeOnClick,
onCheck: zTreeCheck
}
};
$.getJSON('ModuleManager/LoadForTree?bAll=true', function (json) {
var zTreeObj = $.fn.zTree.init($('#lookupTree'), setting, json);
zTreeObj.expandAll(true);
});
}
function zTreeCheck(e, treeId, treeNode) {
var zTree = $.fn.zTree.getZTreeObj(treeId),
nodes = zTree.getCheckedNodes(true);
var ids = '';
for (var i = 0; i < nodes.length; i++) {
ids += ',' + nodes[i].Id;
}
if (ids.length > 0) { //去掉第一个逗号
ids = ids.substr(1);
}
$("#btnSelected").attr("data-args", "{ ids: '" + ids + "' }");
}
function zTreeOnClick(event, treeId, treeNode) {
var zTree = $.fn.zTree.getZTreeObj(treeId);
zTree.checkNode(treeNode, !treeNode.checked, true, true);
event.preventDefault();
}
//@@ sourceURL=lookupMulti.js
</script>