
这里用到了totalRow参数,本参数为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: '标题', templet: '#title', align: 'left', totalRowText: '合计' },//【合计】所在列
{field: 'total', title: '总关键词', 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, //每页默认显示的数量
limits:[50,200,500],
done:function(res, curr, count){//用于合计数据取整数
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);
});
}
} 