title: Knockoutjs. How to compute data changed inside observable array
body: <p>Please, look at my text. I try to use observableArray of knockoutjs and foreach to compute data of array. 
  Example 1 works fine: total sum computed if you change data in the fields. But Example 2 is not working. </p>
  
  <pre><code>&lt;html&gt;
  &lt;head&gt;                                                                         
      &lt;title&gt;&lt;/title&gt;                                                            
      &lt;script type='text/javascript' src='/js/jquery-1.8.2.min.js'&gt;&lt;/script&gt;     
      &lt;script type='text/javascript' src='/js/knockout-2.1.0.debug.js'&gt;&lt;/script&gt; 
  &lt;/head&gt;                                                                        
  &lt;body&gt;
  &lt;p&gt;Example 1&lt;/p&gt;
  &lt;div&gt;
      &lt;p&gt;
      &lt;input data-bind="value: fnum1" /&gt;
      &lt;input data-bind="value: fnum2" /&gt;
      &lt;span data-bind="text: ftotsum"&gt;&lt;/span&gt;
      &lt;/p&gt;
  &lt;/div&gt;    
  &lt;p&gt;Example 2&lt;/p&gt;
  &lt;div&gt;
      &lt;p&gt;
      &lt;!-- ko foreach: fields --&gt;
      &lt;input data-bind="value: $data" /&gt;
      &lt;!-- /ko --&gt;
      &lt;span data-bind="text: ltotsum"&gt;&lt;/span&gt;
      &lt;/p&gt;
  &lt;/div&gt;
  &lt;/body&gt;
  &lt;script&gt;
      function vm(){
          //Calc Example 1
          var self = this;
          self.fnum1 = ko.observable(1);
          self.fnum2 = ko.observable(2);
          self.ftotsum = ko.computed(function(){
              return parseFloat(self.fnum1()) + parseFloat(self.fnum2());
          });
          //Calc Example 2
          self.fields = ko.observableArray([1, 2]);
          self.ltotsum = ko.computed(function(){
              var total = 0;
              ko.utils.arrayForEach(self.fields(), function(item) {
                  total += parseFloat(item);
              })
              return total;
          }); 
      };
  
      ko.applyBindings(new vm());
  &lt;/script&gt;
  &lt;/html&gt;
  </code></pre>