title: Correct way to redraw a DataTable? Getting errors: "no method 'fnDraw'" and "cannot read property 'oFeatures'"
body: <p>I have inherited the following code:</p>
  
  <pre><code>  // Show / Hide table rows from checkboxes
    $("table.data#report-table .warning").toggle($("#warning_checkbox").is(":checked"));
    $("#warning_checkbox").click(function() {
      $("table.data#report-table .warning").toggle($("#warning_checkbox").is(":checked"));
      $('.data_table#report-table').dataTable().fnDraw();
    });
  </code></pre>
  
  <p>When a checkbox with id <code>warning_checkbox</code> is checked, it shows/hides the rows (actually, <code>tbody</code> elements) of <code>table.data#report-table</code> which have the class <code>.warning</code></p>
  
  <p>As far as i can see, there is no <code>'.data_table#report-table</code> element on the page - so i assumed something wouldnt work. However - it (magically?) does, i.e. the table is redrawn as expected, preserving its correct settings. I do however get the following error in the Chrome console:</p>
  
  <pre><code>Uncaught TypeError: Cannot read property 'oFeatures' of null 
  </code></pre>
  
  <p>Which i thought may be due to the missing element (but then how does it still work?) Anyway, i rewrote the code as a function as i need to reuse it elsewhere:</p>
  
  <pre><code>  var checkbox_rows = function(checkbox_id, table_id, tbody_class) {
      var checkbox = $('div.buttons input[id$='+checkbox_id+']');
      var table = $('table.data[id$='+table_id+']');
  
      checkbox.click(function() {
        $('tbody[class$='+tbody_class+']', table).toggle(checkbox.is(':checked'));
        table.fnDraw();
      });
    }
  
    checkbox_rows('warning_checkbox', 'report-table', 'warning');
  </code></pre>
  
  <p>This also works (and makes more sense to me) - but now i get a different error in the Chrome Console:</p>
  
  <pre><code>Uncaught TypeError: Object [object Object] has no method 'fnDraw'
  </code></pre>
  
  <p>So my question is, what am i doing wrong? What is the correct way to redraw a DataTable?</p>
  
  <p>Thank you</p>