0

I have a Datatable which i need to detect when the CSV or PDF has completed being downloaded.

My reason is that i need to display a loader whilst this is downloading but I can't find a solution to this.

The reason i need it is that it take's 10 seconds for my CSV to be downloaded due to the amount of data in my table so i need the loader otherwise there's no visual to the user that its downloading.

I also thought of initially displaying my loader when they click the button for 10 seconds but then if the table has 20 records the file is downloaded straight away so the user would see the loader for 10 seconds and also wouldn't be able to do anything else on the site and if it takes longer then the user may think that the down load has completed when in fact it hasn't.

Anyway i cant find any solution how to do of check this using JQuery only.

Is it possible or and i trying to make a car run on square wheels?

murday1983
  • 3,494
  • 12
  • 49
  • 95
  • 1
    https://stackoverflow.com/questions/2343418/browser-event-when-downloaded-file-is-saved-to-disk – Keith Jul 17 '19 at 08:59
  • As @Leonidas199x mentioned this link contains a good enough solution http://gruffcode.com/2010/10/28/detecting-the-file-download-dialog-in-the-browser/ – Andam Jul 17 '19 at 09:10
  • @Andam Thanks but my app is pure front end and has no .net, c#, php etc code which the link relates to as i dont know backend code as im a pure front end dev – murday1983 Jul 18 '19 at 07:48
  • Corrrect. Ok. Did you try processing attribute like this https://datatables.net/reference/option/processing – Andam Jul 18 '19 at 08:00

0 Answers0