ColReorder sum of columns

ColReorder sum of columns

vivalazvivalaz Posts: 10Questions: 6Answers: 0

In drawCallback i need to calc values in column. I have made it. It works fine.

    drawCallback: function(row, data, start, end, display) {
        var cols = [0, 3, 4, 8]; // cols indexes
        var api = this.api(), data;
        var z = document.querySelectorAll('.calc-numbers');
        Array.prototype.forEach.call(z, function(el, i) {
            z[i].innerHTML = new BigNumber(api.column(cols[i], {filter: 'applied'}).data().sum().toFixed(0)).toFormat(0);
        });         
    }

`
But when i use an extension "ColReorder", after reorder column it doesnt work, becase cols indexes are changing. How to fix it? Thanks for help

This discussion has been closed.