title: Knockout.js: access parent collection in data-bind event
body: <p>Let's say I have a</p>
  
  <pre><code>&lt;button type="button" data-bind="click: actions.remove"&gt;×&lt;/button&gt;
  </code></pre>
  
  <p>and a handler</p>
  
  <pre><code>var actions = {
      remove: function(item) {
          ?array?.remove(item); // ?array? is a containing array, accessed somehow
      }
  }
  </code></pre>
  
  <p>How do I find <code>?array?</code> so I can use the same <code>button</code> in any <code>foreach</code> binding?</p>
  
  <p><strong>Clarification:</strong><br>
  I know how to do that if I put <code>remove</code> into the view model. However the view model contains hierarchical arrays and I do not really want to go through it all just to get methods in the right places. View model is also updated from server occasionally with the help of <code>ko.mapping</code>, but that does not add any methods to the new data. That is why I implemented the handlers separately.</p>