c9e91f675007b84c35372163d5a02f27c0226c31.svn-base 4.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. <%@page language="java" import="java.util.*" pageEncoding="UTF-8"%>
  2. <%
  3. String path = request.getContextPath();
  4. %>
  5. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  6. <html xmlns="http://www.w3.org/1999/xhtml">
  7. <head>
  8. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  9. <title>树形表格</title>
  10. <!--框架必需start-->
  11. <script type="text/javascript" src="<%=path%>/libs/js/jquery.js"></script>
  12. <script type="text/javascript" src="<%=path%>/libs/js/language/cn.js"></script>
  13. <script type="text/javascript" src="<%=path%>/libs/js/framework.js"></script>
  14. <link href="<%=path%>/libs/css/import_basic.css" rel="stylesheet" type="text/css"/>
  15. <link rel="stylesheet" type="text/css" id="skin" prePath="<%=path%>/"/>
  16. <link rel="stylesheet" type="text/css" id="customSkin"/>
  17. <!--框架必需end-->
  18. <!--数据表格start-->
  19. <script src="<%=path%>/libs/js/table/quiGrid.js" type="text/javascript"></script>
  20. <!--数据表格end-->
  21. </head>
  22. <body>
  23. <div class="box2" panelTitle="表格操作">
  24. <input type="button" value="展开杭州办事处" onclick="expandRow2();"/>
  25. <input type="button" value="折叠杭州办事处" onclick="collapseRow2();"/>
  26. 这里通过数据控制初始时全部收缩,自定义图标,并且参数控制点击checkbox不关联子节点。
  27. </div>
  28. <div class="padding_right5">
  29. <div id="maingrid"></div>
  30. </div>
  31. <script type="text/javascript">
  32. var gridData={"rows":[
  33. {"id":1,"parentId":0,"name":"南京分公司","iconClass":"icon_star","open":false,"children":[
  34. {"id":2,"parentId":1,"name":"市场部","iconClass":"icon_list","open":false,"children":[
  35. {"id":3,"parentId":2,"name":"市场1组","iconClass":"icon_mark","children":null},
  36. {"id":11,"parentId":2,"name":"市场2组","iconClass":"icon_mark","children":null},
  37. {"id":12,"parentId":2,"name":"市场3组","iconClass":"icon_mark","children":null}
  38. ]},
  39. {"id":13,"parentId":1,"name":"财务部","iconClass":"icon_list","children":null},
  40. {"id":14,"parentId":1,"name":"行政部","iconClass":"icon_list","children":null},
  41. {"id":15,"parentId":1,"name":"工程部","iconClass":"icon_list","children":null},
  42. {"id":16,"parentId":1,"name":"技术部","iconClass":"icon_list","children":null},
  43. {"id":17,"parentId":1,"name":"生产部","iconClass":"icon_list","open":false,"children":[
  44. {"id":18,"parentId":17,"name":"222","iconClass":"icon_mark","children":null}
  45. ]}
  46. ]},
  47. {"id":7,"parentId":0,"name":"杭州办事处","iconClass":"icon_star","open":false,"children":[
  48. {"id":8,"parentId":7,"name":"接待处","iconClass":"icon_list","children":null},
  49. {"id":9,"parentId":7,"name":"洽谈处","iconClass":"icon_list","children":null}
  50. ]},
  51. {"id":18,"parentId":0,"name":"郑州办事处","iconClass":"icon_star","open":false,"children":[
  52. {"id":19,"parentId":18,"name":"接待处","iconClass":"icon_list","children":null},
  53. {"id":20,"parentId":18,"name":"洽谈处","iconClass":"icon_list","children":null}
  54. ]},
  55. {"id":21,"parentId":0,"name":"苏州办事处","iconClass":"icon_star","open":false,"children":[
  56. {"id":22,"parentId":21,"name":"接待处","iconClass":"icon_list","children":null},
  57. {"id":23,"parentId":21,"name":"洽谈处","iconClass":"icon_list","children":null}
  58. ]},
  59. {"id":24,"parentId":0,"name":"北京办事处","iconClass":"icon_star","children":null}
  60. ]}
  61. var g;
  62. function initComplete(){
  63. //usePager: false设置为不分页
  64. g = $("#maingrid").quiGrid({
  65. columns: [
  66. { display: '部门名', name: 'name', id:'deptId', width: 250, align: 'left' },
  67. { display: '部门id', name: 'id',width: 250, type: 'int', align: 'left' },
  68. { display: '部门parentId', name: 'parentId', width: 250, align: 'left' }
  69. ],
  70. height: '100%', width:"100%",checkbox:true,usePager: false,data:gridData,autoCheckChildren:false,tree: { columnId: 'deptId' }
  71. });
  72. }
  73. function collapseRow2(){
  74. for (var record in g.records){
  75. if(g.records[record]['name']=="杭州办事处"){
  76. g.collapse(g.records[record]);
  77. }
  78. }
  79. }
  80. function expandRow2(){
  81. for (var record in g.records){
  82. if(g.records[record]['name']=="杭州办事处"){
  83. g.expand(g.records[record]);
  84. }
  85. }
  86. }
  87. </script>
  88. </body>
  89. </html>