title: How to call Datatable csv button from custom button
body: <p>Need to call csv button from my custom button.</p>
  
  <pre><code>&lt;button value="Export report to Excel" class="button-default datatable-csv" type="button" id="ExportReporttoExcel"&gt;
                  &lt;span&gt;Export report to Excel&lt;/span&gt;
              &lt;/button&gt;
  </code></pre>
  
  <p>Instead of calling it from the Datatable button, i want the same functionality from the above button.</p>
  
  <p>Looking for some configuration changes in Datatable so that i can call my custom button to export the table records as csv.</p>
  
  <pre><code>var table=$('#tableId').DataTable( {
      "paging":   true,
      "info":     true,
      "searching": true,      
      ,buttons: true
  });
  
  
  $("#SEARCH").on("keyup search input paste cut", function() {
      table.search(this.value).draw();
  });
  
  var buttons = new $.fn.dataTable.Buttons(table, {
       buttons: [
         'csvHtml5'
      ]
  }).container().appendTo($('#ExportReporttoExcel'));
  </code></pre>
  
  <p>Getting output like below but i need only one button.</p>
  
  <p><a href="https://i.stack.imgur.com/SJDQE.png" rel="noreferrer"><img src="https://i.stack.imgur.com/SJDQE.png" alt="enter image description here"></a></p>