title: jquery datatables remove row by index
body: <p>I know this question is popular but all answers are for selected rows.  I am trying to delete / remove a row that is NOT selected.  I have a variable for the table that I want to remove the row from and I have the index of the row that I want to remove.</p>
  
  <p>These are various ways to get a handle to the table or rows:</p>
  
  <pre><code>var table = $('#tableName');
  var rows = $('#tableName tbody tr').toArray();
  var oTable = $('#tableName').dataTable();
  </code></pre>
  
  <p>I know how to use the <code>row.remove()</code> method on a selected row.</p>
  
  <pre><code>var jThisButton = $(this);
  var jRow = jThisButton.parents("tr");
  jRow.remove();
  </code></pre>
  
  <p><strong>But my row is NOT selected</strong>; instead I have an index.  Let's say my index is 2. Using something like the above code, perhaps I can get row by index and remove it like this:</p>
  
  <pre><code>var jRow = table.find('tr').eq(index);
  jRow.remove();
  </code></pre>
  
  <p><strong>Except that does not work</strong>.  That code moves the row I want to delete to the last row and goes wonky, showing the search bar.</p>
  
  <p><a href="https://i.stack.imgur.com/xN74v.png" rel="noreferrer"><img src="https://i.stack.imgur.com/xN74v.png" alt="enter image description here"></a></p>
  
  <p>You can see in the image below that I have 4 rows in the table.</p>
  
  <p><strong>How do I remove the tr that exists at index 2?</strong>  </p>
  
  <p><a href="https://i.stack.imgur.com/DPf0z.png" rel="noreferrer"><img src="https://i.stack.imgur.com/DPf0z.png" alt="enter image description here"></a></p>
  
  <p>I have not been able to find the answer to this question anywhere.  Please help!</p>