title: jQuery Datatables: Uncaught TypeError: Cannot read property 'asSorting' of undefined
body: <p>I'm am new in jQuery, so sorry if my question is too simple.</p>
  
  <p>I am trying to do something like this:</p>
  
  <pre><code>$("#send-one").html('done. ');
  
  var tableProgress= $("&lt;table id='table-progress'&gt;&lt;tr&gt;&lt;td&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;");
  
  $("#send-one").empty().append(tableProgress);
  
  tableProgress.dataTable({
      "bPaginate": false,
      "bLengthChange": false,
      "bFilter": true,
      "bSort": false,
      "bInfo": false,
      "bAutoWidth": false
  });
  </code></pre>
  
  <p>All this occurs inside <a href="http://jqueryui.com/dialog/">jQuery ui Dialog Box</a>.</p>
  
  <p>It does not work, I think it's because <a href="http://www.datatables.net/">.dataTable() pluggin</a> can't find the table so I am trying to use <a href="http://api.jquery.com/jQuery.when/">jQuery $.when</a>.</p>
  
  <p>The error is this</p>
  
  <blockquote>
    <p>Uncaught TypeError: Cannot read property 'asSorting' of undefined</p>
  </blockquote>
  
  <p>What I need is: use .datatable pluggin in a table that is inserted in <code>$("#send-one").html('done. ' + tableProgress)</code> but, using .datatable() directly may not be synchronous to the insertion.</p>
  
  <p>I also tried:</p>
  
  <pre><code>$("#send-one").html('done. ' + tableProgress);
  $('#table-progress').dataTable();
  </code></pre>