标题(实现 jquery 与layui结合生成table表,请求Ajax接口)
//table表
function datas(obj){
// console.log(obj)
layui.use(['laydate', 'laypage', 'layer', 'table'], function () {
var laydate = layui.laydate //日期
, laypage = layui.laypage //分页
, layer = layui.layer //弹层
, table = layui.table //表格
table.render({
elem: '#demoTable' //这里是table id
, height: 550,
limit: 18, //每一页为18条数据
//page:true //这里我没有用到layui里面自带的分页所以没有放出来
loading: true
, data: obj.records //此处是请求的ajax接口数据
, title: 'Table单',
toolbar: '<span>Table单</span>'
, cols: [[ //表头
//{ type: 'checkbox', fixed: 'left' }
{ field: 'recordNum', title: 'ID', width: 50, fixed: 'left