bootstrap table footerFormatter用法 统计列求和 sum、average等

其实上一篇blog里已经贴了代码,简单解释一下吧:

1、showFooter: true,很重要,设置footer显示:

$(cur_table).bootstrapTable({
    url: '/etestpaper/getPaperQType',
    method: 'get',
    queryParams: {strParentID: parentid},
    ajaxOptions: {strParentID: parentid},
    showFooter: true,
2、在列中指定footerFormatter函数:

{
    field: 'questionnum',
    title: '小题数量',
    align: 'center',
    footerFormatter: function (value) {
        var count = 0;
        for (var i in value) {
            count += value[i].questionnum;
        }
        return count;
    }

3、贴个效果图:

原文地址:https://www.cnblogs.com/telwanggs/p/9010451.html