Fetch the repository succeeded.
This action will force synchronization from ele-admin/treetable-lay, which will overwrite any changes that you have made since you forked the repository, and can not be recovered!!!
Synchronous operation will process in the background and will refresh the page when finishing processing. Please be patient.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>tree-table</title>
<link rel="stylesheet" href="assets/layui/css/layui.css">
<link rel="stylesheet" href="assets/common.css"/>
</head>
<body>
<div class="layui-container">
<br><br>
<a class="layui-btn layui-btn-normal" href="index.html"><<返回</a>
<div class="layui-btn-group">
<button class="layui-btn" id="btn-expand1">全部展开</button>
<button class="layui-btn" id="btn-fold1">全部折叠</button>
</div>
<table id="table1" class="layui-table" lay-filter="table1"></table>
</div>
<!-- 操作列 -->
<script type="text/html" id="oper-col">
<a class="layui-btn layui-btn-primary layui-btn-xs" lay-event="edit">修改</a>
<a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del">删除</a>
</script>
<script src="assets/layui/layui.js"></script>
<script>
layui.config({
base: 'module/'
}).extend({
treetable: 'treetable-lay/treetable'
}).use(['table', 'treetable'], function () {
var $ = layui.jquery;
var table = layui.table;
var treetable = layui.treetable;
// 渲染表格
var renderTable1 = function () {
layer.load(2);
$.getJSON('json/data.json', function (res) {
treetable.render({
treeColIndex: 1,
treeSpid: -1,
treeIdName: 'id',
treePidName: 'pid',
treeDefaultClose: true,
treeLinkage: false,
elem: '#table1',
data: res.data,
page: false,
cols: [[
{type: 'numbers'},
{field: 'id', title: 'id'},
{field: 'name', title: 'name'},
{field: 'sex', title: 'sex'},
{field: 'pid', title: 'pid'},
{templet: '#oper-col', title: 'oper'}
]],
done: function () {
layer.closeAll('loading');
}
});
});
};
renderTable1();
$('#btn-expand1').click(function () {
treetable.expandAll('#table1');
});
$('#btn-fold1').click(function () {
treetable.foldAll('#table1');
});
});
</script>
</body>
</html>
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。