title: knockout - computed observable with parameter working only on alternate clicks
body: <p>I have a main checkbox, clicking on which all the checkboxes are checked. For the child checkboxes, I have some different logic involving their computation from 2 different observables besides the mainCheckBox and when child checkboxes are checked, the value needs to be written to different observables.</p>
  
  <p>I have created a computed observable with parameter as below:</p>
  
  <pre><code>var vm = ko.mapping.fromJS(data);
  var viewModel = 
  function () 
  {
      this.self = this;
      this.ExportSchemas = vm;
      this.SelectAll = ko.observable(true);
      this.IsChecked = function (checkboxVM) {
          return ko.computed({
              read: function () {
                  return this.SelectAll(); //problemLine
              },
              write: function (value) {
                  checkboxVM.Selected(value);
                  alert(checkboxVM.Selected());
              },
              owner: this.self
          });
      };
  };
  
  &lt;input type="checkbox" data-bind="checked: SelectAll" value="None" id="mainCheckBox" name="check" /&gt;
  
  &lt;div data-bind="foreach: ExportSchemas"&gt;
      &lt;div data-bind="foreach: Clauses"&gt;
          &lt;input type="checkbox" value="None" data-bind="checked: $root.IsChecked($data), attr: { id: 'clause' + Id(), value: Id() }" name="check" /&gt;
      &lt;/div&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>The write behavior of computed observable is weird, it works on alternate clicks when the <code>problemLine</code> in above code is as written above. And when I use the following instead for <code>problemLine</code>:</p>
  
  <pre><code>return this.SelectAll;
  </code></pre>
  
  <p>Then the write of computed observable works properly, but the the read stops working and checking/unchecking mainCheckBox has no effect on child check boxes.</p>
  
  <p>Any suggestions?</p>