jquery ui dialog和ztree简单结合
程序员文章站
2022-06-12 09:12:52
...
<head> <meta charset="utf-8"> <title>jQuery UI Dialog - Modal form</title> <link rel="stylesheet" href="css/ui-lightness/jquery-ui-1.10.4.custom.min.css"> <link rel="stylesheet" href="css/zTreeStyle/zTreeStyle.css"> <script src="js/jquery-1.10.2.js"></script> <script src="js/jquery-ui-1.10.4.custom.min.js"></script> <script src="js/jquery.ztree.core-3.5.js"></script> <script src="js/jquery.ztree.excheck-3.5.js"></script> <script> $(function() { var setting = { check: { enable: true, chkStyle: "radio", radioType: "all" }, data: { simpleData: { enable: true } } }; var zNodes =[ { id:1, pId:0, name:"随意勾选 1", open:true}, { id:11, pId:1, name:"随意勾选 1-1", open:true}, { id:111, pId:11, name:"随意勾选 1-1-1"}, { id:112, pId:11, name:"随意勾选 1-1-2"}, { id:12, pId:1, name:"随意勾选 1-2", open:true}, { id:121, pId:12, name:"随意勾选 1-2-1"}, { id:122, pId:12, name:"随意勾选 1-2-2"}, { id:2, pId:0, name:"随意勾选 2", checked:true, open:true}, { id:21, pId:2, name:"随意勾选 2-1"}, { id:22, pId:2, name:"随意勾选 2-2", open:true}, { id:221, pId:22, name:"随意勾选 2-2-1", checked:true}, { id:222, pId:22, name:"随意勾选 2-2-2"}, { id:23, pId:2, name:"随意勾选 2-3"} ]; $( "#dialog-form" ).dialog({ autoOpen: false, height: 300, width: 350, modal: true, buttons: { "确定": function() { var treeObj = $.fn.zTree.getZTreeObj("treeDemo"); var nodes = treeObj.getCheckedNodes(true); var result = ""; var tt = ""; for(var i=0;i<nodes.length;i++){ if(!nodes[i].isParent){ result += nodes[i].name + ","; tt = nodes[i].id; } } $("#deptList").html(result); $("#deptid").val(tt); $( this ).dialog( "close" ); }, "取消": function() { $( this ).dialog( "close" ); } }, close: function() { } }); $( "#create-user" ) .button() .click(function() { $.fn.zTree.init($("#treeDemo"), setting, zNodes); $( "#dialog-form" ).dialog( "open" ); }); }); </script> </head> <body> <div id="dialog-form" title="部门结构" > <div style="z-index:990;"> <ul id="treeDemo" class="ztree"></ul> </div> </div> <button id="create-user">选择部门</button> <span id="deptList"></span> <input id="deptid" type="text" value=""> <div class="demo-description"> </body> </html>
上一篇: 爸爸五岁了
下一篇: Vue.js动态组件解析
推荐阅读
-
Vue和element-ui结合的简单使用
-
jquery 的dialog和ztree结合实现步骤
-
Vue和element-ui结合的简单使用
-
jquery ui dialog和ztree简单结合
-
jquery ui 的dialog样式问题求助!!!右上角的关闭和右下角的控制大小的都和demo中的不一样!_html/css_WEB-ITnose
-
jquery 的dialog和ztree结合实现步骤
-
jquery ui 的dialog样式问题求助!!!右上角的关闭和右下角的控制大小的都和demo中的不一样!_html/css_WEB-ITnose
-
把jquery 的dialog和ztree结合实现步骤_jquery
-
把jquery 的dialog和ztree结合实现步骤_jquery
-
html、css和jquery相结合实现简单的进度条效果实例代码