title: How to get searched rows from Datatables at API function call context
body: <p>JSFiddle for this question: <a href="http://jsfiddle.net/nhg5ej4s/" rel="nofollow noreferrer">http://jsfiddle.net/nhg5ej4s/</a></p>
  
  <p>I use the 1.10.15 version of Datatables. </p>
  
  <p>I have this <code>sum()</code> function registered in API: </p>
  
  <pre><code> $.fn.dataTable.Api.register('sum()', function () {
       var data = this.flatten().toArray();
       return data.reduce(function (a, b) {
           return (a * 1) + (b * 1); // cast strings
       }, 0);
   });
  </code></pre>
  
  <p>When I need to use this function, for example, in <a href="https://datatables.net/reference/option/drawCallback" rel="nofollow noreferrer"><code>drawCallback</code></a> option for update totals in footer (see <a href="http://jsfiddle.net/nhg5ej4s/" rel="nofollow noreferrer">JSFiddle</a> for context):</p>
  
  <pre><code>var table = $('#example').DataTable({
      drawCallback: function (settings) {
         var api = this.api();
         $(api.column(5).footer()).html('Total: ' + api.column(5).data().sum());
      }
  });
  </code></pre>
  
  <p>The function works, but when I apply filter on the table with any search, the values passed to <code>sum()</code> take all rows, not that filtered by search.</p>
  
  <p>There is a way to identify the search context inside the <code>sum()</code> function?</p>
  
  <p><strong>PS:</strong> While writing this questions, I realize that I can pass a option in column call that will filter only searched rows: <code>api().column(5, {'search': 'applied'}).data().sum()</code> but I decide to keep the question to know if there is a way to do this inside the <code>sum()</code> code. <a href="http://jsfiddle.net/ops7w7v9/" rel="nofollow noreferrer">JSFidlle with this update</a></p>