knockout checked binding doesn't update
<p>I have list of objects I can select. I made a select all checkbox to click which selects all. The selecting works, but it doesn't update the checkbox value itself. Also, deselecting doesn't work, because the value is never true.</p>

<pre><code>//html
&lt;input type="checkbox" data-bind="checked: selecAllBT, click: selectAll" /&gt; Select all
//other stuff

//JS
    self.selecAllBT = ko.observable(false);

    self.selectAllBodyTypes = function (self) {
     for (i = 0; i &lt; self.items().length; i++) {
        if (self.selecAllBT() != self.items()[i].selected()){
            self.toggleSelected(self.items()[i]);
        }
    }
    self.selecAllBT(!self.selecAllBT);

    return true;

   }
</code></pre>

<p>I put it in a JSFiddle:
<a href="https://jsfiddle.net/5mquej1f/21/" rel="nofollow noreferrer">https://jsfiddle.net/5mquej1f/21/</a>
(I actually reused a JSFiddle from another issue of me, in case somebody recognizes it: <a href="https://stackoverflow.com/questions/41161828/knockout-observablearray-in-2-templates">knockout observablearray in 2 templates</a>)</p>

<p>Anyone an idea what I'm doing wrong?
thx</p>