21c190d156d2b3304873ee62bcadef37f66dd9d5.svn-base 7.9 KB

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