如何仅显示值列中的一个值 但是我试过但是我正在获取值的总和,而且我无法计算渲染值的总和 如果您看到屏幕截图,则将了解
"footerCallback": function (row, data, start, end, display) {
var api = this.api(), data;
// Remove the formatting to get integer data for summation
var intVal = function (i) {
return typeof i === 'string' ?
i.replace(/[\$,]/g, '') * 1 :
typeof i === 'number' ?
i : 0;
};
//
var AllPackageCompletedFICtotal = api
.column(3)
.data()
.reduce(function (a, b) {
return intVal(a) + intVal(b);
}, 0);
//
//
var AllPackageRecordedFICtotal = api
.column(5)
.data()
.reduce(function (a, b) {
return intVal(a) + intVal(b);
}, 0);
var CompletedStructures = api
.column(7)
.data()
.reduce(function (a, b) {
return intVal(a) + intVal(b);
}, 0);
var RecordedStructures = api
.column(9)
.data()
.reduce(function (a, b) {
return intVal(a) + intVal(b);
}, 0);
//$(api.column(2).footer()).html(Total);
$(api.column(3).footer()).html(AllPackageCompletedFICtotal);
$(api.column(5).footer()).html(AllPackageRecordedFICtotal);
$(api.column(7).footer()).html(CompletedStructures);
$(api.column(9).footer()).html(RecordedStructures);
[![enter image description here][1]][1]
},
我正在获取列值的总和,但我只想要一个值而不是总和