3d2d697d8564528ef792953ddc447b8cc6d2b86b.svn-base 8.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305
  1. <%@ page language="java" contentType="text/html; charset=UTF-8" 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 type="text/javascript" src="<%=path%>/libs//js/table/treeTable.js"></script>
  20. <!--树形表格end-->
  21. </head>
  22. <body>
  23. <div class="box1" panelWidth="800">
  24. <fieldset>
  25. <legend>1、基本用法</legend>
  26. <table class="treeTable">
  27. <tr>
  28. <th width="250">名称</th>
  29. <th width="120">大小</th>
  30. <th>备注</th>
  31. </tr>
  32. <tr id="node-1">
  33. <td><span class="folder">根目录1</span></td>
  34. <td>--</td>
  35. <td>备注说明</td>
  36. </tr>
  37. <tr id="node-2" class="child-of-node-1">
  38. <td><span class="folder">二级目录1</span></td>
  39. <td>--</td>
  40. <td>备注说明</td>
  41. </tr>
  42. <tr id="node-8" class="child-of-node-2">
  43. <td><span class="file">文件1</span></td>
  44. <td>52 KB</td>
  45. <td>备注说明</td>
  46. </tr>
  47. <tr id="node-9" class="child-of-node-2">
  48. <td><span class="file">文件2</span></td>
  49. <td>4 KB</td>
  50. <td>备注说明</td>
  51. </tr>
  52. <tr id="node-3" class="child-of-node-1">
  53. <td><span class="file">文件3</span></td>
  54. <td>4 KB</td>
  55. <td>备注说明</td>
  56. </tr>
  57. <tr id="node-4" class="child-of-node-1">
  58. <td><span class="folder">二级目录2</span></td>
  59. <td>--</td>
  60. <td>备注说明</td>
  61. </tr>
  62. <tr id="node-5" class="child-of-node-4">
  63. <td><span class="file">文件4</span></td>
  64. <td>56 KB</td>
  65. <td>备注说明</td>
  66. </tr>
  67. <tr id="node-14">
  68. <td><span class="file">文件5</span></td>
  69. <td>4 KB</td>
  70. <td>备注说明</td>
  71. </tr>
  72. <tr id="node-11">
  73. <td><span class="folder">根目录2</span></td>
  74. <td>--</td>
  75. <td>备注说明</td>
  76. </tr>
  77. <tr id="node-12" class="child-of-node-11">
  78. <td><span class="file">文件6</span></td>
  79. <td>4 KB</td>
  80. <td>备注说明</td>
  81. </tr>
  82. </table>
  83. </fieldset>
  84. <div class="height_15"></div>
  85. <fieldset>
  86. <legend>2、不使用图标</legend>
  87. 如果不希望有文件夹和文件的图标,去掉td中的span。
  88. <table class="treeTable">
  89. <tr>
  90. <th width="250">名称</th>
  91. <th width="120">大小</th>
  92. <th>备注</th>
  93. </tr>
  94. <tr id="node-1">
  95. <td>根目录1</td>
  96. <td>--</td>
  97. <td>备注说明</td>
  98. </tr>
  99. <tr id="node-2" class="child-of-node-1">
  100. <td>二级目录1</td>
  101. <td>--</td>
  102. <td>备注说明</td>
  103. </tr>
  104. <tr id="node-8" class="child-of-node-2">
  105. <td>文件1</td>
  106. <td>52 KB</td>
  107. <td>备注说明</td>
  108. </tr>
  109. <tr id="node-9" class="child-of-node-2">
  110. <td>文件2</td>
  111. <td>4 KB</td>
  112. <td>备注说明</td>
  113. </tr>
  114. </table>
  115. </fieldset>
  116. <div class="height_15"></div>
  117. <fieldset>
  118. <legend>3、不可收缩</legend>
  119. 为table添加expandable属性可设置是否可展开/闭合。下面的是一个不可收缩的树形表格
  120. <table class="treeTable" expandable="false">
  121. <tr>
  122. <th width="250">名称</th>
  123. <th width="120">大小</th>
  124. <th>备注</th>
  125. </tr>
  126. <tr id="node-1">
  127. <td><span class="folder">根目录1</span></td>
  128. <td>--</td>
  129. <td>备注说明</td>
  130. </tr>
  131. <tr id="node-2" class="child-of-node-1">
  132. <td><span class="folder">二级目录1</span></td>
  133. <td>--</td>
  134. <td>备注说明</td>
  135. </tr>
  136. <tr id="node-8" class="child-of-node-2">
  137. <td><span class="file">文件1</span></td>
  138. <td>52 KB</td>
  139. <td>备注说明</td>
  140. </tr>
  141. <tr id="node-9" class="child-of-node-2">
  142. <td><span class="file">文件2</span></td>
  143. <td>4 KB</td>
  144. <td>备注说明</td>
  145. </tr>
  146. </table>
  147. 另外table如果设置initState="collapsed" 则初始时树形表格处于收缩状态。
  148. </fieldset>
  149. <div class="height_15"></div>
  150. <fieldset>
  151. <legend>4、ajax模式</legend>
  152. <table class="treeTable" ajaxMode="true">
  153. <tr>
  154. <th width="250">名称</th>
  155. <th width="120">大小</th>
  156. <th>备注</th>
  157. </tr>
  158. <tr id="ajaxnode-1" url="<%=path%>/sample/table/data/table3.html">
  159. <td><span class="folder">根目录1</span></td>
  160. <td>--</td>
  161. <td>备注说明</td>
  162. </tr>
  163. <tr id="ajaxnode-14">
  164. <td><span class="file">文件5</span></td>
  165. <td>4 KB</td>
  166. <td>备注说明</td>
  167. </tr>
  168. <tr id="ajaxnode-11" url="<%=path%>/sample/table/data/table4.html">
  169. <td><span class="folder">根目录2</span></td>
  170. <td>--</td>
  171. <td>备注说明</td>
  172. </tr>
  173. </table>
  174. </fieldset>
  175. <div class="height_15"></div>
  176. <fieldset>
  177. <legend>5、checkbox模式</legend>
  178. <table class="treeTable" checkMode="true" id="mytable">
  179. <tr>
  180. <th width="250">名称</th>
  181. <th width="120">大小</th>
  182. <th>备注</th>
  183. </tr>
  184. <tr id="node-1">
  185. <td><span class="folder">根目录1</span></td>
  186. <td>--</td>
  187. <td>备注说明</td>
  188. </tr>
  189. <tr id="node-2" class="child-of-node-1">
  190. <td><span class="folder">二级目录1</span></td>
  191. <td>--</td>
  192. <td>备注说明</td>
  193. </tr>
  194. <tr id="node-8" class="child-of-node-2">
  195. <td><span class="file">文件1</span></td>
  196. <td>52 KB</td>
  197. <td>备注说明</td>
  198. </tr>
  199. <tr id="node-9" class="child-of-node-2">
  200. <td><span class="file">文件2</span></td>
  201. <td>4 KB</td>
  202. <td>备注说明</td>
  203. </tr>
  204. <tr id="node-4" class="child-of-node-1">
  205. <td><span class="folder">二级目录2</span></td>
  206. <td>--</td>
  207. <td>备注说明</td>
  208. </tr>
  209. <tr id="node-5" class="child-of-node-4">
  210. <td><span class="file">文件4</span></td>
  211. <td>56 KB</td>
  212. <td>备注说明</td>
  213. </tr>
  214. <tr id="node-11">
  215. <td><span class="folder">根目录2</span></td>
  216. <td>--</td>
  217. <td>备注说明</td>
  218. </tr>
  219. <tr id="node-12" class="child-of-node-11">
  220. <td><span class="file">文件6</span></td>
  221. <td>4 KB</td>
  222. <td>备注说明</td>
  223. </tr>
  224. </table>
  225. <br/>
  226. <input type="button" value="查看选中tr的id" onclick="viewCheckIds()"/>
  227. </fieldset>
  228. <div class="height_15"></div>
  229. <fieldset>
  230. <legend>6、ajax模式下的check模式</legend>
  231. <div class="red">此示例由后台支持</div>
  232. <table class="treeTable" ajaxMode="true" checkMode="true">
  233. <tr>
  234. <th width="250">名称</th>
  235. <th width="120">大小</th>
  236. <th>备注</th>
  237. </tr>
  238. <tr id="ajaxnode-1" url="<%=path%>/getTreeTableData.action?id=1">
  239. <td><span class="folder">根目录1</span></td>
  240. <td>--</td>
  241. <td>备注说明</td>
  242. </tr>
  243. <tr id="ajaxnode-2" url="<%=path%>/getTreeTableData.action?id=2">
  244. <td><span class="folder">根目录2</span></td>
  245. <td>--</td>
  246. <td>备注说明</td>
  247. </tr>
  248. </table>
  249. </fieldset>
  250. <div class="height_15"></div>
  251. <fieldset>
  252. <legend>7、动态创建</legend>
  253. <input type="button" value="点击创建" id="testBtn" onclick="createTreeTable()"/>
  254. </fieldset>
  255. <div class="height_15"></div>
  256. </div>
  257. <script>
  258. function viewCheckIds(){
  259. var msg="";
  260. $("#mytable input[type=checkbox]").each(function(){
  261. if($(this).attr("checked")){
  262. msg=msg+","+$(this).parents("tr").attr("id")
  263. }
  264. })
  265. if(msg==""){
  266. msg="无选择"
  267. }
  268. top.Dialog.alert(msg);
  269. }
  270. function createTreeTable(){
  271. var $tableObj=$('<table class="treeTable" ajaxMode="true">'+
  272. '<tr>'+
  273. '<th width="250">名称</th>'+
  274. '<th width="120">大小</th>'+
  275. '<th>备注</th>'+
  276. '</tr>'+
  277. '<tr id="ajaxnode-1" url="data/table3.html">'+
  278. '<td><span class="folder">根目录1</span></td>'+
  279. '<td>--</td>'+
  280. '<td>备注说明</td>'+
  281. '</tr>'+
  282. '<tr id="ajaxnode-11" url="data/table4.html">'+
  283. '<td><span class="folder">根目录2</span></td>'+
  284. '<td>--</td>'+
  285. '<td>备注说明</td>'+
  286. '</tr>'+
  287. '</table>');
  288. $tableObj.render();
  289. $("#testBtn").after($tableObj);
  290. }
  291. </script>
  292. </body>
  293. </html>