title: Electron, SQL.JS, jQuery and populating Datatables
body: <p>I have a table as follows in an app I am creating using Electron. I am using jQuery, Datatables and SQL.js:-</p>
  
  <pre><code>&lt;table id="dataTable" class="display" cellspacing="0" width="100%"&gt;
      &lt;thead&gt;
          &lt;tr&gt;
              &lt;th&gt;Date&lt;/th&gt;
              &lt;th&gt;Code&lt;/th&gt;
              &lt;th&gt;Category&lt;/th&gt;
              &lt;th&gt;Hours&lt;/th&gt;
              &lt;th&gt;Cost&lt;/th&gt;
              &lt;th&gt;Billed&lt;/th&gt;
              &lt;th&gt;Description&lt;/th&gt;
          &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tfoot&gt;
          &lt;tr&gt;
              &lt;th&gt;Date&lt;/th&gt;
              &lt;th&gt;Code&lt;/th&gt;
              &lt;th&gt;Category&lt;/th&gt;
              &lt;th&gt;Hours&lt;/th&gt;
              &lt;th&gt;Cost&lt;/th&gt;
              &lt;th&gt;Billed&lt;/th&gt;
              &lt;th&gt;Description&lt;/th&gt;
          &lt;/tr&gt;
      &lt;/tfoot&gt;
  &lt;/table&gt;
  </code></pre>
  
  <p>The following code to populate the table is not working correctly:-</p>
  
  <pre><code>$(document).ready(function() {
  
      var DB = null;  
  
      var t = $('#dataTable').DataTable();
  
          $(".bottomMenuContainer").on("click", ".loadButton", function(e) {
              var fs = require('fs');
              var sql = require('sql.js');
              var bfr = fs.readFileSync(__dirname + '/../data/EliteData.db');
              DB = new sql.Database(bfr);
              var stmt = DB.prepare("SELECT * FROM ProductEntries ORDER BY Category");
              while(stmt.step()){
                  var row = stmt.getAsObject(); 
                  t.rows.add([row.Date, row.Code, row.Category, row.Hours, row.Cost, row.Billed, row.Description]).draw(false);
              }
          });
  
  
  
  });
  </code></pre>
  
  <p>I get a requested unknown parameter '1' for row 0, column 1 error message and the data ends up spread over the table when it finally displays, and there are 21 results instead of the 3 in the actual database.</p>
  
  <p>Any idea what's happening?</p>