thead.html 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="utf-8">
  5. <title>镜像站@Layui table模块,将已知数据生成数据表格 - 在线演示</title>
  6. <meta name="renderer" content="webkit">
  7. <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  8. <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
  9. <meta name="apple-mobile-web-app-status-bar-style" content="black">
  10. <meta name="apple-mobile-web-app-capable" content="yes">
  11. <meta name="format-detection" content="telephone=no">
  12. <script>
  13. ;!function(){self!==parent&&(location.href="http://www.baidu.com/")}();
  14. </script>
  15. <link rel="stylesheet" href="/public/layui/dist/css/layui.css" tppabs="http://res.layui.com/layui/dist/css/layui.css?t=1632428048355" media="all">
  16. <link rel="stylesheet" href="/public/static/css/global.css" tppabs="http://res.layui.com/static/css/global.css?t=1632428048355-19" media="all">
  17. <style>
  18. .layui-body{overflow-y: scroll}
  19. </style>
  20. </head>
  21. <body>
  22. <div class="layui-layout layui-layout-admin">
  23. <div class="layui-header header header-demo" autumn>
  24. <div class="layui-fluid">
  25. <a class="logo" href="../../index.html" tppabs="http://www.layui.com/">
  26. <img src="/public/static/images/layui/logo.png" tppabs="http://res.layui.com/static/images/layui/logo.png" alt="layui">
  27. </a>
  28. <div class="layui-form layui-hide-xs component" lay-filter="LAY-site-header-component"></div>
  29. <div class="layui-hide-xs site-notice"></div>
  30. <ul class="layui-nav" id="LAY_NAV_TOP">
  31. <li class="layui-nav-item ">
  32. <a href="../../doc/index.html" tppabs="http://www.layui.com/doc/">文档</a>
  33. </li>
  34. <li class="layui-nav-item layui-this">
  35. <a href="../index.html" tppabs="http://www.layui.com/demo/">示例</a>
  36. </li>
  37. <li class="layui-nav-item">
  38. <a href="javascript:;">
  39. <!--<span class="layui-badge-dot" style="left:0; right: auto; margin: -4px 0 0 5px;"></span>-->
  40. 周边
  41. </a>
  42. <dl class="layui-nav-child layui-nav-child-c">
  43. <dd class="layui-hide-sm layui-show-xs" lay-unselect>
  44. <a href="https://gitee.com/sentsin/layui/issues" target="_blank" rel="nofollow">问题反馈</a>
  45. <hr>
  46. </dd>
  47. <dd lay-unselect><a href="../../alone.html" tppabs="http://www.layui.com/alone.html" target="_blank" lay-unselect>独立组件</a></dd>
  48. <dd lay-unselect><a href="../../../fly.layui.com/extend/index.html" target="_blank">扩展组件</a></dd>
  49. </dl>
  50. </li>
  51. <li class="layui-nav-item layui-hide-xs">
  52. <a href="http://gitee.com/sentsin/layui/issues" target="_blank" rel="nofollow">反馈</a>
  53. </li>
  54. </ul>
  55. </div>
  56. </div>
  57. <!-- 让IE8/9支持媒体查询,从而兼容栅格 -->
  58. <!--[if lt IE 9]>
  59. <script src="../../../other/html5shiv/r29/html5.min.js" tppabs="https://cdn.staticfile.org/html5shiv/r29/html5.min.js"></script>
  60. <script src="../../../other/respond.js/1.4.2/respond.min.js" tppabs="https://cdn.staticfile.org/respond.js/1.4.2/respond.min.js"></script>
  61. <![endif]-->
  62. <div class="layui-side layui-bg-black">
  63. <div class="layui-side-scroll">
  64. <ul class="layui-nav layui-nav-tree site-demo-nav">
  65. <li class="layui-nav-item layui-nav-itemed">
  66. <a class="javascript:;" href="javascript:;">演示</a>
  67. <dl class="layui-nav-child">
  68. <dd>
  69. <a href="../index.html" tppabs="http://www.layui.com/demo/">调试预览</a>
  70. </dd>
  71. </dl>
  72. </li>
  73. <li class="layui-nav-item layui-nav-itemed">
  74. <a class="javascript:;" href="javascript:;">布局</a>
  75. <dl class="layui-nav-child">
  76. <dd class="">
  77. <a href="../grid.html" tppabs="http://www.layui.com/demo/grid.html">栅格</a>
  78. </dd>
  79. <dd class="">
  80. <a href="../admin.html" tppabs="http://www.layui.com/demo/admin.html">框架</a>
  81. </dd>
  82. </dl>
  83. </li>
  84. <li class="layui-nav-item layui-nav-itemed">
  85. <a class="javascript:;" href="javascript:;">基本元素</a>
  86. <dl class="layui-nav-child">
  87. <dd class="">
  88. <a href="../button.html" tppabs="http://www.layui.com/demo/button.html">按钮</a>
  89. </dd>
  90. <dd class="">
  91. <a href="../form.html" tppabs="http://www.layui.com/demo/form.html">表单</a>
  92. </dd>
  93. <dd class="">
  94. <a href="../nav.html" tppabs="http://www.layui.com/demo/nav.html">导航 / 面包屑</a>
  95. </dd>
  96. <dd class="">
  97. <a href="../menu.html" tppabs="http://www.layui.com/demo/menu.html">基础菜单</a>
  98. </dd>
  99. <dd class="">
  100. <a href="../tab.html" tppabs="http://www.layui.com/demo/tab.html">选项卡</a>
  101. </dd>
  102. <dd class="">
  103. <a href="../progress.html" tppabs="http://www.layui.com/demo/progress.html">进度条</a>
  104. </dd>
  105. <dd class="">
  106. <a href="../panel.html" tppabs="http://www.layui.com/demo/panel.html">面板</a>
  107. </dd>
  108. <dd class="">
  109. <a href="../badge.html" tppabs="http://www.layui.com/demo/badge.html">徽章</a>
  110. </dd>
  111. <dd class="">
  112. <a href="../timeline.html" tppabs="http://www.layui.com/demo/timeline.html">时间线</a>
  113. </dd>
  114. <dd class="">
  115. <a href="../table-element.html" tppabs="http://www.layui.com/demo/table-element.html">静态表格</a>
  116. </dd>
  117. <dd class="">
  118. <a href="../anim.html" tppabs="http://www.layui.com/demo/anim.html">动画</a>
  119. </dd>
  120. <dd class="">
  121. <a href="../auxiliar.html" tppabs="http://www.layui.com/demo/auxiliar.html">辅助元素</a>
  122. </dd>
  123. </dl>
  124. </li>
  125. <li class="layui-nav-item layui-nav-itemed">
  126. <a class="javascript:;" href="javascript:;">组件示例</a>
  127. <dl class="layui-nav-child">
  128. <dd class="">
  129. <a href="../layer.html" tppabs="http://www.layui.com/demo/layer.html">
  130. 弹出层
  131. </a>
  132. </dd>
  133. <dd class="">
  134. <a href="../laydate.html" tppabs="http://www.layui.com/demo/laydate.html">
  135. 日期与时间选择
  136. </a>
  137. </dd>
  138. <dd class="layui-this">
  139. <a href="../table.html" tppabs="http://www.layui.com/demo/table.html">
  140. 数据表格
  141. </a>
  142. </dd>
  143. <dd class="">
  144. <a href="../laypage.html" tppabs="http://www.layui.com/demo/laypage.html">
  145. 分页
  146. </a>
  147. </dd>
  148. <dd class="">
  149. <a href="../dropdown.html" tppabs="http://www.layui.com/demo/dropdown.html">
  150. 下拉菜单
  151. </a>
  152. </dd>
  153. <dd class="">
  154. <a href="../upload.html" tppabs="http://www.layui.com/demo/upload.html">
  155. 文件上传
  156. </a>
  157. </dd>
  158. <dd class="">
  159. <a href="../transfer.html" tppabs="http://www.layui.com/demo/transfer.html">
  160. 穿梭框
  161. </a>
  162. </dd>
  163. <dd class="">
  164. <a href="../tree.html" tppabs="http://www.layui.com/demo/tree.html">
  165. 树形组件
  166. </a>
  167. </dd>
  168. <dd class="">
  169. <a href="../colorpicker.html" tppabs="http://www.layui.com/demo/colorpicker.html">
  170. 颜色选择器
  171. </a>
  172. </dd>
  173. <dd class="">
  174. <a href="../slider.html" tppabs="http://www.layui.com/demo/slider.html">
  175. 滑块
  176. </a>
  177. </dd>
  178. <dd class="">
  179. <a href="../rate.html" tppabs="http://www.layui.com/demo/rate.html">
  180. 评分
  181. </a>
  182. </dd>
  183. <dd class="">
  184. <a href="../carousel.html" tppabs="http://www.layui.com/demo/carousel.html">
  185. 轮播
  186. </a>
  187. </dd>
  188. <dd class="">
  189. <a href="../laytpl.html" tppabs="http://www.layui.com/demo/laytpl.html">
  190. 模板引擎
  191. </a>
  192. </dd>
  193. <dd class="">
  194. <a href="../flow.html" tppabs="http://www.layui.com/demo/flow.html">
  195. 流加载
  196. </a>
  197. </dd>
  198. <dd class="">
  199. <a href="../util.html" tppabs="http://www.layui.com/demo/util.html">
  200. 工具模块
  201. </a>
  202. </dd>
  203. <dd class="">
  204. <a href="../code.html" tppabs="http://www.layui.com/demo/code.html">
  205. 文本行修饰
  206. </a>
  207. </dd>
  208. </dl>
  209. </li>
  210. <li class="layui-nav-item" style="height: 30px; text-align: center"></li>
  211. </ul>
  212. </div>
  213. </div>
  214. <style>
  215. body .site-demo-title,
  216. body .layui-layout-admin .site-demo{left: 360px}
  217. .layui-layout-admin .site-demo-body{top: 107px;}
  218. body .site-demo-code{left: 160px;}
  219. </style>
  220. <div class="layui-side layui-side-child">
  221. <div class="layui-side-scroll">
  222. <!-- 左侧子菜单 -->
  223. <ul class="layui-nav layui-nav-tree site-demo-table-nav">
  224. <li class="layui-nav-item ">
  225. <a class="layui-nav-title" class="layui-nav-title" href="../table.html" tppabs="http://www.layui.com/demo/table.html">简单数据表格</a>
  226. </li>
  227. <li class="layui-nav-item ">
  228. <a class="layui-nav-title" href="auto.html" tppabs="http://www.layui.com/demo/table/auto.html">列宽自动分配<span class="layui-badge-dot"></span></a>
  229. </li>
  230. <li class="layui-nav-item ">
  231. <a class="layui-nav-title" href="data.html" tppabs="http://www.layui.com/demo/table/data.html">赋值已知数据</a>
  232. </li>
  233. <li class="layui-nav-item ">
  234. <a class="layui-nav-title" href="static.html" tppabs="http://www.layui.com/demo/table/static.html">转化静态表格</a>
  235. </li>
  236. <hr>
  237. <li class="layui-nav-item ">
  238. <a class="layui-nav-title" href="page.html" tppabs="http://www.layui.com/demo/table/page.html">开启分页</a>
  239. </li>
  240. <li class="layui-nav-item ">
  241. <a class="layui-nav-title" href="resetPage.html" tppabs="http://www.layui.com/demo/table/resetPage.html">自定义分页</a>
  242. </li>
  243. <li class="layui-nav-item ">
  244. <a class="layui-nav-title" href="toolbar.html" tppabs="http://www.layui.com/demo/table/toolbar.html">开启头部工具栏<span class="layui-badge-dot"></span></a>
  245. </li>
  246. <li class="layui-nav-item ">
  247. <a class="layui-nav-title" href="totalRow.html" tppabs="http://www.layui.com/demo/table/totalRow.html">开启合计行<span class="layui-badge-dot"></span></a>
  248. </li>
  249. <li class="layui-nav-item ">
  250. <a class="layui-nav-title" href="checkbox.html" tppabs="http://www.layui.com/demo/table/checkbox.html">开启复选框</a>
  251. </li>
  252. <li class="layui-nav-item ">
  253. <a class="layui-nav-title" href="radio.html" tppabs="http://www.layui.com/demo/table/radio.html">开启单选框<span class="layui-badge-dot"></span></a>
  254. </li>
  255. <li class="layui-nav-item ">
  256. <a class="layui-nav-title" href="cellEdit.html" tppabs="http://www.layui.com/demo/table/cellEdit.html">开启单元格编辑</a>
  257. </li>
  258. <hr>
  259. <li class="layui-nav-item ">
  260. <a class="layui-nav-title" href="form.html" tppabs="http://www.layui.com/demo/table/form.html">加入表单元素</a>
  261. </li>
  262. <li class="layui-nav-item ">
  263. <a class="layui-nav-title" href="style.html" tppabs="http://www.layui.com/demo/table/style.html">设置单元格样式</a>
  264. </li>
  265. <li class="layui-nav-item ">
  266. <a class="layui-nav-title" href="fixed.html" tppabs="http://www.layui.com/demo/table/fixed.html">固定列</a>
  267. </li>
  268. <hr>
  269. <li class="layui-nav-item ">
  270. <a class="layui-nav-title" href="operate.html" tppabs="http://www.layui.com/demo/table/operate.html">数据操作</a>
  271. </li>
  272. <li class="layui-nav-item ">
  273. <a class="layui-nav-title" href="parseData.html" tppabs="http://www.layui.com/demo/table/parseData.html">解析任意数据格式<span class="layui-badge-dot"></span></a>
  274. </li>
  275. <li class="layui-nav-item ">
  276. <a class="layui-nav-title" href="onrow.html" tppabs="http://www.layui.com/demo/table/onrow.html">行事件<span class="layui-badge-dot"></span></a>
  277. </li>
  278. <li class="layui-nav-item ">
  279. <a class="layui-nav-title" href="reload.html" tppabs="http://www.layui.com/demo/table/reload.html">数据表格的重载</a>
  280. </li>
  281. <hr>
  282. <li class="layui-nav-item ">
  283. <a class="layui-nav-title" href="height.html" tppabs="http://www.layui.com/demo/table/height.html">高度最大化适应</a>
  284. </li>
  285. <li class="layui-nav-item ">
  286. <a class="layui-nav-title" href="initSort.html" tppabs="http://www.layui.com/demo/table/initSort.html">设置初始排序</a>
  287. </li>
  288. <li class="layui-nav-item ">
  289. <a class="layui-nav-title" href="cellEvent.html" tppabs="http://www.layui.com/demo/table/cellEvent.html">单元格事件</a>
  290. </li>
  291. <li class="layui-nav-item layui-this">
  292. <a class="layui-nav-title" href="thead.html" tppabs="http://www.layui.com/demo/table/thead.html">复杂表头</a>
  293. </li>
  294. <hr>
  295. <li class="layui-nav-item">
  296. <a class="layui-nav-title" href="../../doc/modules/table.html" tppabs="http://www.layui.com/doc/modules/table.html" target="_blank">更多用法见文档</a>
  297. </li>
  298. </ul>
  299. </div>
  300. </div>
  301. <div class="layui-tab layui-tab-brief site-demo-table" lay-filter="demoTitle">
  302. <ul class="layui-tab-title site-demo-title">
  303. <li class="layui-this">预览</li>
  304. <li>查看代码</li>
  305. <li>帮助</li>
  306. </ul>
  307. <div class="layui-body layui-tab-content site-demo site-demo-body">
  308. <div class="layui-tab-item layui-show">
  309. <div class="layui-main">
  310. <div id="LAY_preview">
  311. 常用两级表头:
  312. <table class="layui-table" lay-data="{width:800, url:'../../test/table/demo2.json2.js', page: true, limit: 6, limits:[6]}">
  313. <thead>
  314. <tr>
  315. <th lay-data="{checkbox:true, fixed:'left'}" rowspan="2"></th>
  316. <th lay-data="{field:'username', width:150}" rowspan="2">联系人</th>
  317. <th lay-data="{align:'center'}" colspan="3">地址</th>
  318. <th lay-data="{field:'amount', width:120}" rowspan="2">金额</th>
  319. <th lay-data="{fixed: 'right', width: 160, align: 'center', toolbar: '#barDemo'}" rowspan="2">操作</th>
  320. </tr>
  321. <tr>
  322. <th lay-data="{field:'province', width:120}">省</th>
  323. <th lay-data="{field:'city', width:120}">市</th>
  324. <th lay-data="{field:'zone', width:200}">区</th>
  325. </tr>
  326. </thead>
  327. </table>
  328. 更多级表头(可以无限极):
  329. <table class="layui-table" lay-data="{url:'../../test/table/demo2.json3.js', cellMinWidth: 80, page: true}">
  330. <thead>
  331. <tr>
  332. <th lay-data="{field:'username', width:80}" rowspan="3">联系人</th>
  333. <th lay-data="{field:'amount', width:120}" rowspan="3">金额</th>
  334. <th lay-data="{align:'center'}" colspan="5">地址1</th>
  335. <th lay-data="{align:'center'}" colspan="2">地址2</th>
  336. <th lay-data="{fixed: 'right', width: 160, align: 'center', toolbar: '#barDemo'}" rowspan="3">操作</th>
  337. </tr>
  338. <tr>
  339. <th lay-data="{field:'province'}" rowspan="2">省</th>
  340. <th lay-data="{field:'city'}" rowspan="2">市</th>
  341. <th lay-data="{align:'center'}" colspan="3">详细</th>
  342. <th lay-data="{field:'province'}" rowspan="2">省</th>
  343. <th lay-data="{field:'city'}" rowspan="2">市</th>
  344. </tr>
  345. <tr>
  346. <th lay-data="{field:'street'}" rowspan="2">街道</th>
  347. <th lay-data="{field:'address'}">小区</th>
  348. <th lay-data="{field:'house'}">单元</th>
  349. </tr>
  350. </thead>
  351. </table>
  352. <script type="text/html" id="barDemo">
  353. <a class="layui-btn layui-btn-primary layui-btn-xs" lay-event="detail">按钮1</a>
  354. <a class="layui-btn layui-btn-primary layui-btn-xs" lay-event="edit">按钮2</a>
  355. </script>
  356. <p style="color: #999">注:上述例子读取的均是静态模拟数据</p>
  357. </div>
  358. <blockquote class="layui-elem-quote" style="margin-top: 30px;">
  359. 更多我们未能呈现的示例,还有待您在阅读文档、以及不断使用的过程,去深入挖掘。
  360. </blockquote>
  361. <div style="margin: 15px 0 100px; padding-bottom: 100px;">
  362. </div>
  363. </div>
  364. </div>
  365. <div class="layui-tab-item">
  366. <textarea class="layui-border-box site-demo-text site-demo-code" id="LAY_democode" spellcheck="false" readonly>
  367. <!DOCTYPE html>
  368. <html>
  369. <head>
  370. <meta charset="utf-8">
  371. <title>镜像站@Layui</title>
  372. <meta name="renderer" content="webkit">
  373. <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  374. <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
  375. <link rel="stylesheet" href="/public/layui/dist/css/layui.css" tppabs="http://res.layui.com/layui/dist/css/layui.css" media="all">
  376. <!-- 注意:如果你直接复制所有代码到本地,上述css路径需要改成你本地的 -->
  377. </head>
  378. </textarea>
  379. </div>
  380. <div class="layui-tab-item">
  381. <div class="layui-main">
  382. <p></p>
  383. <fieldset class="layui-elem-field layui-field-title" style="margin-top: 50px;">
  384. <legend>相关</legend>
  385. </fieldset>
  386. <a class="layui-btn layui-btn-normal" href="../../doc/modules/table.html" tppabs="http://www.layui.com/doc/modules/table.html" target="_blank">表格模块文档</a>
  387. </div>
  388. </div>
  389. </div>
  390. </div>
  391. <div class="layui-footer footer footer-demo">
  392. <p>
  393. Copyright &copy; 2021 <a href="../../index.html" tppabs="http://www.layui.com/">「本站仅为 layui 文档保留的镜像站点,与官方无关」</a> MIT Licensed</p>
  394. <p>
  395. <a href="../../about/disclaimer.html" tppabs="http://www.layui.com/about/disclaimer.html" target="_blank">免责声明</a>
  396. <a href="../../about/relatedlinks.html" tppabs="http://www.layui.com/about/relatedlinks.html" target="_blank">友链</a>
  397. <a href="javascript:;" site-event="weixinmp">公众号</a>
  398. </p>
  399. <div class="site-union">
  400. <p class="site-union-desc">
  401. <span>
  402. </span>
  403. </p>
  404. </div>
  405. </div>
  406. <script>
  407. window.global = {
  408. pageType: 'demo'
  409. ,preview: function(){
  410. var preview = document.getElementById('LAY_preview');
  411. return preview ? preview.innerHTML : '';
  412. }()
  413. };
  414. </script>
  415. <div class="site-tree-mobile layui-hide">
  416. <i class="layui-icon layui-icon-spread-left"></i>
  417. </div>
  418. <div class="site-mobile-shade"></div>
  419. <script src="/public/layui/dist/layui.js" tppabs="http://res.layui.com/layui/dist/layui.js?t=1632428048355" charset="utf-8"></script>
  420. <script>
  421. layui.config({
  422. base: '/public/static/lay/modules/layui/'
  423. ,version: '1632428048355'
  424. }).use('global');
  425. </script>
  426. </div>
  427. <div id="LAY_democodejs">
  428. <script>
  429. layui.use('table', function(){
  430. var table = layui.table;
  431. });
  432. </script>
  433. </div>
  434. </body>
  435. </html>