關於Layui Table分頁功能


html代碼 

<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 分頁是需要自己再后台寫分頁查詢的!!!!

這么簡單的一個東西,迷惑了我兩天


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM