<table class="layui-hide layui-table" id="demo" lay-filter="reviewlist"></table>
JS 代码
- var table = layui.table;// 表格
- // 执行一个 table 实例
- table.render({
- elem: '#demo'
- , height: 460
- , url: '/AuditRecord/ReportList' // 数据接口
- , cols: [[ // 表头
- {
- field: 'AuditId', width: '10%', title: '编号'
- },
- {
- field: 'ReportCode', width: '20%', align: 'center', title: '报告编号', style: 'color: #339999;cursor: pointer', event: 'formLink'
- },
- {
- field: 'ReportName', width: '20%', align: 'center', title: '报告名称'
- },
- {
- field: 'ReviewName', width: '10%', align: 'center', title: '审核人'
- },
- {
- field: 'ReviewTime', width: '10%', align: 'center', title: '审核时间'
- },
- {
- field: 'ReviewResult', width: '10%', align: 'center', title: '审核结果'
- },
- {
- field: 'ReviewAdvice', width: '20%', align: 'center', title: '审核建议'
- },
- ]]
- , skin: 'row'
- , even: true
- , page: true // 开启分页
- , limits: [3, 5, 10]
- , limit: 5 // 每页默认显示的数量
- , done: function (res) {
- data = res.data;
- }
- });
- ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
刚开始我以为我只需要将数据传给 layui table, 它可以自己进行分页功能, 但是我发现数据根本没有进行分页, 但是每次点击上一页, 下一页, NetWork 里面都有发起请求的记录,
而且每次都传了页数和条数.
最后我发现, layui table 分页是需要自己再后台写分页查询的!!!!
这么简单的一个东西, 迷惑了我两天
来源: http://www.bubuko.com/infodetail-3002116.html