0

I am following this example:

https://datatables.net/extensions/buttons/examples/initialisation/export

I want if I confirm the file exporting , the page will reload. How can I do this?

OUN Saif
  • 305
  • 1
  • 4
  • 20
  • Possible duplicate of [How to reload a page using JavaScript?](https://stackoverflow.com/questions/3715047/how-to-reload-a-page-using-javascript) – P.S. Aug 09 '17 at 08:34

1 Answers1

1

You can customize the button's action. Try this :

$(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
                    }
        }
    ]
  });

}); 

Here is a working Fiddle

Hamza Abdaoui
  • 2,029
  • 4
  • 23
  • 36