title: How to add a column SUM feature to my datatable?
body: <p>I have created a datatable which has a multi search feature in the footer and I would like to have a feature which adds up all the salaries of what is currently displayed or searched. I am not sure how to do that.</p>
  
  <hr>
  
  <p><strong>Here is my HTML code for the table</strong></p>
  
  <pre><code>    &lt;script src="https://code.jquery.com/jquery-3.3.1.js"&gt;&lt;/script&gt;
      &lt;script src="https://cdn.datatables.net/1.10.19/js/jquery.dataTables.min.js"&gt;&lt;/script&gt;
      &lt;script src="./search.js"&gt;&lt;/script&gt;
      &lt;link href="https://cdn.datatables.net/1.10.19/css/jquery.dataTables.min.css"&gt;
      &lt;!-- Required meta tags --&gt;
      &lt;meta charset="utf-8"&gt;
      &lt;meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"&gt;
      &lt;!-- Bootstrap CSS --&gt;
      &lt;link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous"&gt;
  
     &lt;table id="example" class="display" style="width:100%"&gt;
              &lt;thead&gt;
                  &lt;tr&gt;
                      &lt;th&gt;Name&lt;/th&gt;
                      &lt;th&gt;Position&lt;/th&gt;
                      &lt;th&gt;Office&lt;/th&gt;
                      &lt;th&gt;Age&lt;/th&gt;
                      &lt;th&gt;Start date&lt;/th&gt;
                      &lt;th&gt;Salary&lt;/th&gt;
                  &lt;/tr&gt;
              &lt;/thead&gt;
              &lt;tbody&gt;
                  &lt;tr&gt;
                      &lt;td&gt;Tiger Nixon&lt;/td&gt;
                      &lt;td&gt;System Architect&lt;/td&gt;
                      &lt;td&gt;Edinburgh&lt;/td&gt;
                      &lt;td&gt;61&lt;/td&gt;
                      &lt;td&gt;2011/04/25&lt;/td&gt;
                      &lt;td&gt;$320,800&lt;/td&gt;
                  &lt;/tr&gt;
                  &lt;tr&gt;
                      &lt;td&gt;Garrett Winters&lt;/td&gt;
                      &lt;td&gt;Accountant&lt;/td&gt;
                      &lt;td&gt;Tokyo&lt;/td&gt;
                      &lt;td&gt;63&lt;/td&gt;
                      &lt;td&gt;2011/07/25&lt;/td&gt;
                      &lt;td&gt;$170,750&lt;/td&gt;
                  &lt;/tr&gt;
                  &lt;tr&gt;
                      &lt;td&gt;Ashton Cox&lt;/td&gt;
                      &lt;td&gt;Junior Technical Author&lt;/td&gt;
                      &lt;td&gt;San Francisco&lt;/td&gt;
                      &lt;td&gt;66&lt;/td&gt;
                      &lt;td&gt;2009/01/12&lt;/td&gt;
                      &lt;td&gt;$86,000&lt;/td&gt;
                  &lt;/tr&gt;
                  &lt;tr&gt;
                      &lt;td&gt;Cedric Kelly&lt;/td&gt;
                      &lt;td&gt;Senior Javascript Developer&lt;/td&gt;
                      &lt;td&gt;Edinburgh&lt;/td&gt;
                      &lt;td&gt;22&lt;/td&gt;
                      &lt;td&gt;2012/03/29&lt;/td&gt;
                      &lt;td&gt;$433,060&lt;/td&gt;
                  &lt;/tr&gt;
                  &lt;tr&gt;
                      &lt;td&gt;Airi Satou&lt;/td&gt;
                      &lt;td&gt;Accountant&lt;/td&gt;
                      &lt;td&gt;Tokyo&lt;/td&gt;
                      &lt;td&gt;33&lt;/td&gt;
                      &lt;td&gt;2008/11/28&lt;/td&gt;
                      &lt;td&gt;$162,700&lt;/td&gt;
                  &lt;/tr&gt;
                  &lt;tr&gt;
                      &lt;td&gt;Brielle Williamson&lt;/td&gt;
                      &lt;td&gt;Integration Specialist&lt;/td&gt;
                      &lt;td&gt;New York&lt;/td&gt;
                      &lt;td&gt;61&lt;/td&gt;
                      &lt;td&gt;2012/12/02&lt;/td&gt;
                      &lt;td&gt;$372,000&lt;/td&gt;
                  &lt;/tr&gt;
                  &lt;tr&gt;
                      &lt;td&gt;Herrod Chandler&lt;/td&gt;
                      &lt;td&gt;Sales Assistant&lt;/td&gt;
                      &lt;td&gt;San Francisco&lt;/td&gt;
                      &lt;td&gt;59&lt;/td&gt;
                      &lt;td&gt;2012/08/06&lt;/td&gt;
                      &lt;td&gt;$137,500&lt;/td&gt;
                  &lt;/tr&gt;
                  &lt;tr&gt;
                      &lt;td&gt;Rhona Davidson&lt;/td&gt;
                      &lt;td&gt;Integration Specialist&lt;/td&gt;
                      &lt;td&gt;Tokyo&lt;/td&gt;
                      &lt;td&gt;55&lt;/td&gt;
                      &lt;td&gt;2010/10/14&lt;/td&gt;
                      &lt;td&gt;$327,900&lt;/td&gt;
                  &lt;/tr&gt;
                 &lt;/tbody&gt;
              &lt;tfoot&gt;
                  &lt;tr&gt;
                      &lt;th&gt;Name&lt;/th&gt;
                      &lt;th&gt;Position&lt;/th&gt;
                      &lt;th&gt;Office&lt;/th&gt;
                      &lt;th&gt;Age&lt;/th&gt;
                      &lt;th&gt;Start date&lt;/th&gt;
                      &lt;th&gt;Salary&lt;/th&gt;
                  &lt;/tr&gt;
              &lt;/tfoot&gt;
          &lt;/table&gt;
  </code></pre>
  
  <hr>
  
  <p><strong>Here is my search.js Code</strong></p>
  
  <pre><code> $(document).ready(function() {
      // Setup - add a text input to each footer cell
      $('#example tfoot th').each( function () {
          var title = $(this).text();
          $(this).html( '&lt;input type="text" placeholder="Search '+title+'" /&gt;' );
      } );
  
      // DataTable
      var table = $('#example').DataTable();
  
      // Apply the search
      table.columns().every( function () {
          var that = this;
  
          $( 'input', this.footer() ).on( 'keyup change', function () {
              if ( that.search() !== this.value ) {
                  that
                      .search( this.value )
                      .draw();
              }
          } );
      } );
    } );
  </code></pre>
  
  <p>I am trying to add a sum feature to this code where it adds up the total of the salary column, can someone please help me? im not sure how to do this</p>