title: jQuery DataTables - get page of a given row
body: <p>I have a dataTable with hundreds of items with a fixed 50 iDisplayLength option. I need to be able to find what page a specific row is within the loaded nodes.</p>
  
  <p>All I've managed is to get the position, unfortunately that internal row position does not correspond to the row index with the current sorting and filtering. </p>
  
  <p>As an example here on <a href="http://jsfiddle.net/VFtQQ/" rel="noreferrer">jsFiddle</a>. I can retrieve the position or row #tr4 (position 3) but the iDisplayStart I need is 2.</p>
  
  <pre><code>&lt;table id="example"&gt;
        &lt;thead&gt;
            &lt;tr&gt;
              &lt;th&gt;ID&lt;/th&gt;
              &lt;th&gt;Rendering engine&lt;/th&gt;
              &lt;th&gt;Browser&lt;/th&gt;
              &lt;th&gt;Platform(s)&lt;/th&gt;
              &lt;th&gt;Engine version&lt;/th&gt;
              &lt;th&gt;CSS grade&lt;/th&gt;
            &lt;/tr&gt;
          &lt;/thead&gt;
          &lt;tbody&gt;
            &lt;tr id="tr1" class="odd gradeX"&gt;
              &lt;td&gt;1&lt;/td&gt;
              &lt;td&gt;Trident&lt;/td&gt;
              &lt;td&gt;Internet Explorer 4.0&lt;/td&gt;
              &lt;td&gt;Win 95+&lt;/td&gt;
              &lt;td class="center"&gt; 4&lt;/td&gt;
              &lt;td class="center"&gt;X&lt;/td&gt;
            &lt;/tr&gt;
            &lt;tr id="tr2" class="even gradeC"&gt;
              &lt;td&gt;2&lt;/td&gt;
              &lt;td&gt;Trident&lt;/td&gt;
              &lt;td&gt;Internet Explorer 5.0&lt;/td&gt;
              &lt;td&gt;Win 95+&lt;/td&gt;
              &lt;td class="center"&gt;5&lt;/td&gt;
              &lt;td class="center"&gt;C&lt;/td&gt;
            &lt;/tr&gt;
            &lt;tr id="tr3" class="odd gradeA"&gt;
              &lt;td&gt;3&lt;/td&gt;
              &lt;td&gt;Trident&lt;/td&gt;
              &lt;td&gt;Internet Explorer 5.5&lt;/td&gt;
              &lt;td&gt;Win 95+&lt;/td&gt;
              &lt;td class="center"&gt;5.5&lt;/td&gt;
              &lt;td class="center"&gt;A&lt;/td&gt;
            &lt;/tr&gt;
            &lt;tr id="tr4" class="even gradeA"&gt;
              &lt;td&gt;4&lt;/td&gt;
              &lt;td&gt;Trident&lt;/td&gt;
              &lt;td&gt;Internet Explorer 6&lt;/td&gt;
              &lt;td&gt;Win 98+&lt;/td&gt;
              &lt;td class="center"&gt;6&lt;/td&gt;
              &lt;td class="center"&gt;A&lt;/td&gt;
            &lt;/tr&gt;
            &lt;tr id="tr5" class="odd gradeA"&gt;
              &lt;td&gt;5&lt;/td&gt;
              &lt;td&gt;Trident&lt;/td&gt;
              &lt;td&gt;Internet Explorer 7&lt;/td&gt;
              &lt;td&gt;Win XP SP2+&lt;/td&gt;
              &lt;td class="center"&gt;7&lt;/td&gt;
              &lt;td class="center"&gt;A&lt;/td&gt;
            &lt;/tr&gt;
      &lt;/tbody&gt;
  &lt;/table&gt;
  
  var oTable = $("#example").dataTable({
      "sDom": '&lt;"clear"&gt;rtip&lt;"clear"&gt;',
      "bPaginate": true,
      "iDisplayLength": 2,
  });
  
  var row = $(oTable.fnGetNodes()).filter("#tr4");
  console.log(row[0]);
  
  var position = oTable.fnGetPosition(row[0]);
  console.log(position);
  
  console.log(oTable.fnSettings()._iDisplayStart);;
  
  // position is 3 but the page displayStart I need is 2.
  </code></pre>