
這里用到了totalRow參數(shù),本參數(shù)為layui 2.4.0 新增
var tableIn = table.render({
id: 'news',
elem: '#list',
url: '{:url("industry")}',
method: 'post',
page: true,
totalRow: true,//開啟合并行
cols: [[
{field: 'id', title: '序號', align: 'center', width:"5%", fixed: true},
{field: 'title', title: '標(biāo)題', templet: '#title', align: 'left', totalRowText: '合計' },//【合計】所在列
{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, //每頁默認(rèn)顯示的數(shù)量
limits:[50,200,500],
done:function(res, curr, count){//用于合計數(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);
});
}
} 