<div class="admin-data">
	<table class="layui-hide" id="demo" lay-filter="test"></table>
	<script type="text/html" id="toolbarDemo">
		<div class="layui-btn-container">
			<button class="layui-btn layui-btn-sm" lay-event="getCheckData">获取选中行数据</button>
			<button class="layui-btn layui-btn-sm" lay-event="getCheckLength">获取选中数目</button>
			<button class="layui-btn layui-btn-sm" lay-event="isAll">验证是否全选</button>
		</div>
	</script>
	<script type="text/html" id="barDemo">
		<a class="layui-btn layui-btn-xs btn-red" lay-event="edit"><span
				class="iconfont icon-shangchuan-copy"></span>上传数据</a>
		<a class="layui-btn layui-btn-xs btn-green"><span class="iconfont icon-icon-shujuguanli"></span>数据管理</a>
		<a class="layui-btn layui-btn-xs btn-warn"><span class="iconfont icon-LC_icon_edit_line_1"></span>查看文档记录</a>
	</script>
</div>

<script src="layui/layui.js" type="text/javascript" charset="utf-8"></script>
		
		<script type="text/javascript">
			layui.use('table', function() {
				var table = layui.table;
				table.render({
					elem: '#demo',
					url: 'json/zdTable.json',
					height: 490,
					cols: [
						[{
							type: 'checkbox',
							width: 55,
						}, {
							field: 'name',
							align: 'center',
							title: '公司名称'
						}, {
							field: 'work',
							align: 'center',
							title: '行业'
						}, {
							field: 'createTime',
							align: 'center',
							title: '创建时间'
						}, {
							field: 'riseTime',
							align: 'center',
							title: '最后生成文档时间'
						}, {
							field: 'right',
							width: 360,
							title: '操作',
							align: 'center',
							toolbar: '#barDemo',
						}]
					],
					page: true,
					done: function(res, curr, count) {
						table.on('checkbox(test)', function(obj) {
							$('.del-btn').click(function() {
								if (obj.checked == true) {
									layer.confirm('真的删除行么', function(index) {
										obj.del();
										layer.close(index);
									});
								}
							})
						});
					}
				});
			});
		</script>

By lxcss

发表评论

您的电子邮箱地址不会被公开。 必填项已用*标注