How do you sum up a column of text-boxes that have been modified?

How do you sum up a column of text-boxes that have been modified?

RooRoo Posts: 2Questions: 2Answers: 0
edited July 2015 in Free community support

I have a column of text boxes and you can edit them. After you edit a text box and click an update button it sums up all the values and displays it some where on the page. The way I have it now, it only sums up the column on the first page and it doesn't take into account values that have been modified? Help?

This is what I have so far.

    function aggregateQuantityPurchased() {

        var total = 0;

        var intVal = function (i) {
            if( typeof i === 'string')
            {
                var div = document.createElement('div');
                div.innerHTML = i;
                return div.firstElementChild.value == "" ? 0 : div.firstElementChild.value * 1;
            }
            return typeof i === 'number' ? i : 0;
        }

        var cols = table.column(1).data();
        for (var i = 0; i < cols.length; i++) {
            total += intVal(cols[i]);
        }

        return total;
    }
This discussion has been closed.