代码拉取完成,页面将自动刷新
同步操作将从 叶落阁/layui-soul-table 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>layui-soul-table</title>
<meta name="keywords" content="layui,table,表头筛选,tablefilter,tableChild,子表,表格筛选"/>
<meta name="description" content="layui表头筛选,tablefilter,tableChild,子表,表格筛选"/>
<meta name="renderer" content="webkit">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<meta name="apple-mobile-web-app-status-bar-style" content="black">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="format-detection" content="telephone=no">
<link rel="stylesheet" href="//www.layuicdn.com/layui/css/layui.css" media="all"/>
<link rel="stylesheet" href="soulTable.css" media="all"/>
</head>
<body>
<div class="layui-row">
<div class="layui-col-lg3 layui-col-md4 layui-col-sm6">
<div class="layui-inline">
<label class="layui-form-label">诗词</label>
<div class="layui-input-inline" >
<input type="text" name="title"
class="layui-input" placeholder="请输入诗词关键字">
</div>
</div>
</div>
<div class="layui-col-lg3 layui-col-md4 layui-col-sm6">
<div class="layui-inline">
<label class="layui-form-label">内容</label>
<div class="layui-input-inline">
<input type="text" name="content"
class="layui-input" placeholder="请选择内容关键词">
</div>
</div>
</div>
<div class="layui-col-lg1 layui-col-md1 layui-col-sm2 layui-col-xs3">
<button class="layui-btn mgl-20" lay-submit="" lay-filter="search"><i class="layui-icon"></i>查询</button>
</div>
<div class="layui-col-lg1 layui-col-md1 layui-col-sm2 layui-col-xs3">
<button class="layui-btn mgl-20" lay-submit="" lay-filter="export"><i class="layui-icon"></i>导出</button>
</div>
</div>
<table id="myTable" ></table>
<script type="text/html" id="bar">
<a class="layui-btn layui-btn-xs" lay-event="edit">编辑</a>
<a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del">删除</a>
</script>
<script type="text/javascript" src="//www.layuicdn.com/layui/layui.js"></script>
<script>
// 自定义模块
layui.config({
base: 'ext/', // 模块目录
version: 'v1.8.0'
}).extend({ // 模块别名
soulTable: 'soulTable'
});
layui.use(['form', 'table','soulTable'], function () {
var table = layui.table,
soulTable = layui.soulTable,
form = layui.form,
$ = layui.$;
var myTable = table.render({
elem: '#myTable'
,url: 'data.json'
,height: $(document).height() - $('#myTable').offset().top - 20
,totalRow: true
,page: false
,cols: [[
{type: 'checkbox', fixed: 'left'},
{field: 'title', title: '诗词', width: 165 , fixed:'left', totalRowText: '合计', sort: true, filter: true},
{field: 'dynasty', title: '朝代', width: 165 , sort: true, filter: true, excel:function (d) {
var colors = {'清代':'01AAED', '唐代':'FFB800', '宋代':'FF5722','明代':'5FB878'};
return {
color: colors[d.dynasty]?'FFFFFF':'000000',
bgColor: colors[d.dynasty]
}
}},
{field: 'author', title: '作者', width: 165 , filter: true},
{field: 'type', title: '类型', width: 112, filter: {split:','}, sort:true},
{field: 'content', title: '内容', width: 823, filter: true},
{field: 'heat', title: '点赞数', width: 112, totalRow: true, filter: true, sort:true, excel:{cellType: 'n'}},
{field: 'createTime', title: '录入时间', width: 165, filter: {type: 'date[yyyy-MM-dd HH:mm:ss]'}, sort:true, excel:{cellType: 'd'}},
{title: '操作', width: 156, fixed: 'right', templet: '#bar'}
]]
,done: function () {
soulTable.render(this)
}
});
form.on('submit(search)', function (data) {
myTable.reload({
where: data.field
})
})
form.on('submit(export)', function () {
soulTable.export(myTable);
})
})
</script>
</body>
</html>
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。