//layui 模塊渲染
layui.use(['form', 'layedit', 'laydate', 'upload', 'element'], function () {
var form = layui.form
, layer = layui.layer, layedit = layui.layedit, laydate = layui.laydate
, upload = layui.upload, element = layui.element, table=layui.table;
// 動態數據表渲染/ 自定義field顯示值
table.render({
elem: '#test' /* 綁定表格容器id */
, url: '/i/point/getalluser' /* 獲取數據的后端API URL */
//, where: { getlist: 'orderlist' } /* 這里還可以額外的傳參到后端 */
, method: 'post' /* 使用什么協議,默認的是GET */
, cellMinWidth: 60 /* 最小單元格寬度 */
, cols: [[
{ field: 'Id', title: 'Id', align: 'center', hide: true, width: 60 }
, { field: 'Point', title: '積分', align: 'center', width: 140 }
, { field: 'Remark', title: '備注', align: 'center', sort: false, width: 300 }
, {
field: 'CheckState', title: '狀態', align: 'center', sort: false, width: 160, templet: function (res) {
if (res.CheckState == 2) {
return '真好';
} else if (res.CheckState == 3) {
return '好';
}
}
}
, { field: 'MyRemark', title: 'Phản hồi', align: 'center', sort: false, }
]] // 使用sort將自動為我們添加排序事件,完全不用人工干預
, page: true //是否顯示分頁
, limit: 10 //每頁默認顯示的數量
, id: 'testReload' // 這里就是重載的id
, limits: [10, 20, 40] //分頁條數
, done: function (res, curr, count) {
//當無數據時顯示內容
if (res.count == 0) {
$(".layui-table-main").html('<div class="layui-none">Không có số liệu</div>');
} else {
//修改總條數
$(".layui-laypage-count").html(res.count);
//修改總條數 limit select顯示內容
$("#layui-table-page1").find("option").each(function () {
$(this).html($(this).val());
});
}
}
});
}
分頁顯示內容調整
無數據提示語修改