title: File export in jquery datatables using dropdown change event
body: <p>I developed a functionality for file export using <code>JQuery Datatable Collections</code>. When I click on a button e.g PDF (see image below), it exports Datatable as PDF file.</p>
  
  <p><a href="https://i.stack.imgur.com/v052U.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/v052U.png" alt="enter image description here"></a></p>
  
  <p><strong>Here Is My Code for that.</strong></p>
  
  <pre><code>buttons: [
     {
         extend: 'collection',
         text: 'Save &amp; Column Visibility',
         autoClose: true,
         buttons: [
                     { text: 'Copy', extend: 'copyHtml5'},
                     { text: 'Excel', extend: 'excelHtml5'},
                     { text: 'CSV', extend: 'csvHtml5'},
                     { text: 'PDF', extend: 'pdfHtml5'},
                     { text: 'Print', extend: 'print' }
  
                  ],
              fade: true,
     }
  ],
  </code></pre>
  
  <p>My requirement is to implement this functionality on drop-down change event instead of button click event.</p>
  
  <p><strong>Here is my code for drop-down i have done so far.</strong></p>
  
  <pre><code>$('&lt;div class="pull-right"&gt;' +
          '&lt;select id="dropdown" name="dropdown" class="form-control"&gt;' +
          '&lt;option value="copy"&gt;Copy&lt;/option&gt;' +
          '&lt;option value="excel"&gt;Excel&lt;/option&gt;' +
          '&lt;option value="csv"&gt;CSV&lt;/option&gt;' +
          '&lt;option value="pdf"&gt;PDF&lt;/option&gt;' +
          '&lt;option value="print"&gt;print&lt;/option&gt;' +
          '&lt;/select&gt;' +
          '&lt;/div&gt;').appendTo("#tbMenu_wrapper .dataTables_filter");
      $(".dataTables_filter label").addClass("pull-right");
  });
  </code></pre>
  
  <p><strong>Here is the Function for Onchange Event which I have created For Testing Purpose.</strong></p>
  
  <pre><code>$(function () {
  
          $("#dropdown").change(function () {
  
              if ($(this).val() == "copy") {
                  alert("From Copy");
  
  
              }
              else if ($(this).val() == "excel") {
                  alert("From excel");
  
              }
              else if ($(this).val() == "csv") {
                  alert("From csv");
              }
              else if ($(this).val() == "pdf") {
                  alert("From pdf");
              }
              else if ($(this).val() == "print") {
                  alert("From print");
              } else {
                  alert("From else part");
              }
          });
  </code></pre>
  
  <p>It works fine when I click on Drop-down value and gives me alert as specified in function. But now what should I do in above mentioned code which will give me file export functionality on Drop-down change event?</p>