我正在使用pivottable.js,一切正常,除了排序。这里的问题是,当我尝试使用bulit-in排序数据时,总列显示错误的值,实际上单元格值和总列单元格值的差异很小,如图所示
配置
{
rows: ["Property Name"],
cols: ["Year",'Month'],
aggregators: {
"temp": successRate,
},
}
var successRate = function() {
return function() {
return {
sumSuccesses: 0,
sumTrials: 0,
totalRecord:0,
push: function(record) {
if (!isNaN(parseFloat(record['temp']))) {
this.sumSuccesses += parseFloat(record['temp']);
}
this.totalRecord++;
},
value: function() { return (this.sumSuccesses++) },
format: function(x) { return $filter('number')(x,2) },
numInputs: 0
};
};
};