I have a table of values where I need a total on the row and column. The row total is a simple computed observable and works fine, but the array of computed observables used to store the column totals does not update.
In my example, when changing values in the grid, the monthTotals array does not update.
Why aren’t these changes updating? Should I be doing this differently?
The value of monthNumber in
val += parseFloat(self.resourceCategories[i].monthAmounts[monthNumber].amount());is always set to its last value (11), because the computed evaluates after the fact, and uses the last value set for monthNumber.Here is an updated jsfiddle with the computed changed to a regular function that takes in the month to compute:
http://jsfiddle.net/MYMtH/7/