title: Retrieving data bound object
body: <p>I created a ViewModel which has an observable property. I bind this array to an <code>ul</code> HTML element, like this:</p>
  
  <pre class="lang-html prettyprint-override"><code>&lt;ul id="sortable" 
      data-bind="template: { name: 'parameterTemplate', 
                             foreach: parameters }, 
                 visible: parameters().length &gt; 0" 
      style="width: 100%"&gt;
  &lt;/ul&gt;
  </code></pre>
  
  <p>My template is this:</p>
  
  <pre class="lang-html prettyprint-override"><code>&lt;script type="text/html" id="parameterTemplate"&gt;
      &lt;li class="ui-state-default parameterItem"&gt;
          &lt;input type="checkbox" data-bind="checked: isRequired" /&gt;
          Name:
          &lt;input data-bind="value: name " /&gt; 
          Type:
          &lt;input data-bind="value: type " /&gt; 
          Size:
           &lt;input data-bind="value: size " /&gt; 
          &lt;a href="#" data-bind="click: remove"&gt;Delete&lt;/a&gt;
      &lt;/li&gt;
  &lt;/script&gt;
  </code></pre>
  
  <p>I'm using the draggable and sortable resources of jQuery to reorder the elements of the list. This means that when the users changes the order of the element, obviously ko databind is not altered, for jQuery does not know knockout exists.</p>
  
  <p>It so happens that I want my <code>parameters</code> to be saved in the same order the user configured. So my approach was to select al the  <code>li</code> HTML elements via jQuery, getting an array (    <code>var items = $(".parameterItem");</code>) . How can I get , for each item in <code>items</code>, the databound knockout element, associated with the <code>li</code> HTML element?</p>
  
  <p>Is it possible?</p>
  
  <p>My View Model:</p>
  
  <pre><code>function parameter(parameterName, parameterType, parameterSize, descriptive, defaultValue, isRequired, ownerViewModel) {
      this.name = ko.observable(parameterName);
      this.type = ko.observable(parameterType);
      this.size = ko.observable(parameterSize);
      this.label = ko.observable(parameterName);
      this.descriptive = ko.observable(descriptive);
      this.defaultValue = ko.observable(defaultValue);
      this.descriptive = ko.observable(descriptive);
      this.isRequired = ko.observable(isRequired);
      this.ownerViewModel = ownerViewModel;
      this.remove = function () {
          ownerViewModel.parameters.remove(this)
      };
  }
  
  function excelLoaderViewModel() {
      this.parameters = ko.observableArray([]);
      this.newParameterName = ko.observable();
      this.newParameterType = ko.observable();
      this.newParameterSize = ko.observable();
      this.newParameterDescriptive = ko.observable();
      this.newParameterIsRequired = ko.observable();
      this.newParameterDefaultValue = ko.observable();
  
      this.systemName = ko.observable();
  
      this.addParameter = function () {
          this.parameters.push(
              new parameter(
                   this.newParameterName()
                 , this.newParameterType()
                 , this.newParameterSize()
                 , this.newParameterDescriptive()
                 , this.newParameterDefaultValue()
                 , this.newParameterIsRequired()
                 , this));
          this.newParameterName("");
          this.newParameterType("");
          this.newParameterSize("");
          this.newParameterIsRequired(false);
          this.newParameterDefaultValue("");
      }
  
  var myVM = new excelLoaderViewModel();
  ko.applyBindings(myVM);
  </code></pre>