2017-08-09 46 views

回答

1

您可以自定義按鈕的動作。試試這個:

$(document).ready(function() { 

    $('#example').DataTable({ 
    dom: 'Bfrtip', 
    buttons: [ 
     {//Start the creation of the button 
      extend: "csv",//It's a button that export the table dtat into a CSV file 
      text: "export and relode",//The text of the button 
      action: function(e, dt, button, config) { 
       //The action of the button 
       $.fn.dataTable.ext.buttons.csvHtml5.action.call(this, e, dt, button, config);//Export the data 
       window.location.reload(false);//Relode the page 
        } 
     } 
    ] 
    }); 

}); 

這裏的工作Fiddle

相關問題