Not sure how to subtotal a table properly without creating an endless change loop.
Here is an example of a table where the columns are subtotaled in the last row.
The subtotal function sets the last input with the total of the above rows. Simple.
However the subtotal function needs to run, when a column's value is changed. IE:
$('li.opExpenses').on('change', '.budget, .matchBudget, .rereq, .matchExp', function() { SubTotal(); });
This means I can not run a .change() method when setting the value. Since it would go into an endless loop, changing the column, thinking there is an update, and subtotaling again.
Here is where that causes problems. When you do not run a .change() method setting a field value, the value of the field is displayed properly, but it doesn't actually contain the value yet for other functions to act on.
So I have another function that needs to run after subtotaling, I call the function, it attempt to read the subtotals, and it returns the incorrect value.
How do you properly set the value of the last field in a table with a full .change() event without creating an endless loop?