title: Delete rows in Datatable before destroying
body: <p>I am initializing a Datatable each time the function lds is called. The function lds pulls data for table and appends the relevant HTML by </p>
  
  <pre><code>$('#tablebody').html(data);
  </code></pre>
  
  <p>After that I am initializing a datatable like so, </p>
  
  <pre><code>$('#rTable').Datatable({
        paging:false,
        destroy: true
  });
  </code></pre>
  
  <p>This solves the problem of the error "Datatables cannot be initialized" if I call the lds function again. But the old rows are retained that were appended previously. I have tried the following approaches:</p>
  
  <p>Assigned var table to the initialization of Datatable and put table.empty() at the beginning of lds. But as expected, the table variable is undefined. </p>
  
  <p>Tried to delete row(0) while length > 0 but that messes the table and deletes the  as well. </p>
  
  <p>Tried ('#rTable').empty() but due to this Datatables throws an error d[i] not defined.</p>
  
  <p>What is an approach I can take to empty the rows each time the function lds is called.</p>