'Javascript totalPriceFormatter function is not returing Current Page Total

function totalPriceFormatter(data) {

    var field = this.field
    total = data.reduce(function (sum, row) {
        return sum + (+row[field]);

    }, 0);
    var num = '$' + total.toFixed(0);
    return num;
}

while using this function I am getting the total sum. But I want the sum of Current Page as total. I am using Bootstrap Datatable with Paging enabled



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source