title: Knockout group list into smaller lists with objects
body: <p>I have daily data for multiple employees and depending on the start time and end time that could mean a lot of data. </p>
  
  <p>So with the mapping plugin i mapped them into one big list, but i will need them grouped by employee into smaller lists so i can make a tables per employee (like smaller view models) that has filtering and sorting for that subset of data.</p>
  
  <p>Here is a basic example i created with static data.</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>$(function () {
      var data = {
          Employees: [{
              Id: 1,
              Name: "Employee1",
              Day: new Date(),
              Price: 12.54
          }, {
              Id: 2,
              Name: "Employee2",
              Day: new Date(),
              Price: 112.54
          }, {
              Id: 1,
              Name: "Employee1",
              Day: new Date(),
              Price: 12.54
          }, {
              Id: 3,
              Name: "Employee3",
              Day: new Date(),
              Price: 12.54
          }]
      };
  
      // simulate the model to json conversion. from now on i work with the json
      var jsonModel = JSON.stringify(data);
  
      function employeeModel(data) {
          var employeeMapping = {
              'copy': ["Id", "Name", "Day", "Price"]
          };
          ko.mapping.fromJS(data, employeeMapping, this);
      }
  
      function employeeViewModel(data) {
          var self = this;
          var employeesMapping = {
              'Employees': {
                  create: function (options) {
                      return new employeeModel(options.data);
                  }
              }
          };
          ko.mapping.fromJSON(data, employeesMapping, self);
      }
  
      var productsModel = new employeeViewModel(jsonModel);
      ko.applyBindings(productsModel);
  });</code></pre>
  <pre class="snippet-code-css lang-css prettyprint-override"><code>table {
      border-collapse: collapse;    
  }
  table, th, td {
      border: 1px solid black;
  }
  tr:nth-child(even) {
      background-color: white;
  }
  tr:nth-child(odd) {
      background-color: #C1C0C0;
  }</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;script src="//ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"&gt;&lt;/script&gt;
  &lt;script src="//cdnjs.cloudflare.com/ajax/libs/knockout/3.2.0/knockout-min.js"&gt;&lt;/script&gt;
  &lt;script src="//cdnjs.cloudflare.com/ajax/libs/knockout.mapping/2.4.1/knockout.mapping.js"&gt;&lt;/script&gt;
  &lt;table&gt;
    &lt;tbody data-bind="foreach: Employees"&gt;
      &lt;tr&gt;
        &lt;td&gt;&lt;span data-bind="text:Id"&gt;&lt;/span&gt;
        &lt;/td&gt;
        &lt;td&gt;&lt;span data-bind="text:Name"&gt;&lt;/span&gt;
        &lt;/td&gt;
        &lt;td&gt;&lt;span data-bind="text:Day"&gt;&lt;/span&gt;
        &lt;/td&gt;
        &lt;td&gt;&lt;span data-bind="text:Price"&gt;&lt;/span&gt;
        &lt;/td&gt;
      &lt;/tr&gt;
    &lt;/tbody&gt;
  &lt;/table&gt;</code></pre>
  </div>
  </div>
  </p>