這里用到了totalRow參數(shù),本參數(shù)為layui 2.4.0 新增
var tableIn = table.render({ id: 'news', elem: '#list', url: '{:url("industry")}', method: 'post', page: true, totalRow: true,//開(kāi)啟合并行 cols: [[ {field: 'id', title: '序號(hào)', align: 'center', width:"5%", fixed: true}, {field: 'title', title: '標(biāo)題', templet: '#title', align: 'left', totalRowText: '合計(jì)' },//【合計(jì)】所在列 {field: 'total', title: '總關(guān)鍵詞', align: 'centet', totalRow: true },//totalRow定義為true {field: 'done', title: '已上線', align: 'centet', totalRow: true },//totalRow定義為true {field: 'pre', title: '待處理',align: 'centet', totalRow: true },//totalRow定義為true {title: '詳情', align: 'center', toolbar: '#col_set', width:"10%"}, ]], limit: 50, //每頁(yè)默認(rèn)顯示的數(shù)量 limits:[50,200,500], done:function(res, curr, count){//用于合計(jì)數(shù)據(jù)取整數(shù) var divArr = $(".layui-table-total div.layui-table-cell"); $.each(divArr,function (index,item) { var _div = $(item); var content = _div.html(); content = content.replace(".00",""); _div.html(content); }); } }