1. 程式人生 > >bootstrap-table統計列的值,實現表格統計?

bootstrap-table統計列的值,實現表格統計?

我嘗試了使用Column options裡footerFormatter這個屬性,然而columns: [{

            field: 'classNo',
            title: '編號'
        }, {
            field: 'phoneNo',
            title: '電話'
        }, {
            field: 'createTime',
            title: '時間'
        },{
            footerFormatter:
                fuction(data){
                          cosole.log
(data); return 'xxx'; } }]

得到的是一列 “-” 的資料,那麼問題來了。。。。
1.能否解釋一下footerFormatter是幹嘛用的怎麼使用;
2.怎麼實現表格統計功能,需要合計一列資料的和;         

www.wobiji.net 我筆記

showFooter:true 表格設定裡這一個選項還需要設定一下,難怪一直沒效果。。。。

{ field: 'questionnum', title: '小題數量', align:

'center', footerFormatter: function (value) { var count = 0; for(var i in value) { count += value[i].questionnum; } returncount; }