加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
testTableReversal.html 1.90 KB
一键复制 编辑 原始数据 按行查看 历史
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport"
content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
<title>测试表格反转</title>
<link rel="stylesheet" href="layui/src/css/layui.css" media="all">
<style>
body {
/*margin: 10px;*/
}
table.myTable+ .layui-table-view.vertical thead tr:first-child th .layui-table-cell {
width: 48px;
}
</style>
</head>
<body>
<table class="layui-hide myTable" id="demo" lay-filter="test"></table>
<script src="layui/src/layui.js"></script>
<script>
layui.config({base: 'layui/plug/'}).extend({tablePlug: 'tablePlug/tablePlug'})
.use(['tablePlug'], function () {
var tablePlug = layui.tablePlug;
var table = layui.table;
table.render({
elem: '#demo'
, height: 500
// , url: 'json/data.json' //数据接口
, data:[
{name: '河北', chema: 28, rengong: 39},
{name: '北京', chema: 43, rengong: 49},
{name: '上海', chema: 78, rengong: 71},
{name: '成都', chema: 25, rengong: 28},
{name: '广州', chema: 102, rengong: 78}
]
, title: '用户表'
// , page: false //开启分页
, loading: true
, cellMinWidth: 90
// 默认反转
, reversal: true
, cols: [
[
{title: ''},
{title: 1},
{title: 2},
{title: 3},
{title: 4},
{title: 5}
]
, [ //表头
{field: 'name', title: '名称'},
{field: 'chema', title: '车马费'},
{field: 'rengong', title: '人工费'},
{field: 'bangong', title: '办公费用'},
{field: 'can', title: '餐费'},
{field: 'pei', title: '培训费'}
]
]
});
});
</script>
</body>
</html>
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化