<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>
相关推荐
引入jqueryui、ztree 的js和css文件 <body> <button value=”点击弹出树的dialog对话框” onclick =”getTree()”/> ”ztree” class=”ztree”/> </body> [removed] function getTree(){ var url...
总的来说,“Best jQuery UI”是一个全面介绍和展示jQuery UI功能的资源集合,它涵盖了从基础到高级的各种用例,对于开发者来说,无论是初学者还是有经验的程序员,都是一个极好的学习和参考资源。通过实践这些案例...
在本文中,我们将深入探讨如何使用Jquery.Treeview和Jquery UI来创建一个Web文件预览功能。这两个JavaScript库在Web开发中广泛用于增强用户体验,尤其是处理文件管理和展示。让我们一起详细了解一下它们的工作原理和...
"easyui+ztree后台管理系统模板"意味着已经有一个预设的、结合了EasyUI和ZTree的管理界面,开发者只需要根据实际需求填充数据和调整细节,就能快速构建出一个完整的后台系统。 5. **文件结构**:在"flmkFrame"这个...
为了达到下拉框的效果,通常会结合其他库如jQuery UI的`dialog`或自定义CSS样式来模拟。当点击下拉按钮时,zTree的树结构将以弹出框的形式显示。 3. **数据绑定**:zTree的数据源通常是一个JSON数组,每个对象代表...
总结来说,jQuery插件为我们提供了扩展和定制功能的强大工具,zTree和EasyUI作为两个优秀的jQuery插件,分别在树形菜单和UI组件方面提供了便捷的解决方案。通过灵活运用这些插件,我们可以构建出功能丰富的Web应用...
**ztree** 是一个基于jQuery的JavaScript树插件,它提供了一种灵活的方式来展示和操作数据结构为树形的UI。ztree不仅支持基本的节点操作(如展开、折叠、添加、删除等),还提供了丰富的API接口和事件系统,使得...