DataTables / TableTools

Please note that TableTools has now been retired and replaced by the Buttons and Select extensions which offers significant improvements and API integration with the rest of DataTables and the other extensions.
http://datatables.net/
Other
237 stars 149 forks source link

Multiple calls to swf file #72

Open jhfrench opened 9 years ago

jhfrench commented 9 years ago

I happened to notice in my application that the copy_csv_xls_pdf.swf is getting called three times when datatables/tabletools are invoked. I put together a jsfiddle to illustrate the issue:

Multiple calls to the same file

The same behavior can be observed from the TableTools documentation: Even from the official documentation

Why is this file getting loaded multiple times? It's particularly problematic because the intial load of the file doesn't seem to be cached by the browser for subsequent loads.

alesnav commented 9 years ago

I think that it is loaded in a per flash button basis. So, do you have three buttons (flash type buttons) in your datatable? El 12/12/2014 18:25, "Jeromy French" notifications@github.com escribió:

I happened to notice in my application that the copy_csv_xls_pdf.swf is getting called three times when datatables/tabletools are invoked. I put together a jsfiddle to illustrate the issue http://jsfiddle.net/jhfrench/6b74w/391/:

[image: Multiple calls to the same file] https://cloud.githubusercontent.com/assets/1501167/5415872/825b7916-81f8-11e4-838c-a65c4756fc14.png

The same behavior can be observed from the TableTools documentation https://datatables.net/extensions/tabletools/: [image: Even from the official documentation] https://cloud.githubusercontent.com/assets/1501167/5416022/9f5f7dfe-81f9-11e4-9455-7c274417b1f4.png

Why is this file getting loaded multiple times? It's particularly problematic because the intial load of the file doesn't seem to be cached by the browser for subsequent loads.

— Reply to this email directly or view it on GitHub https://github.com/DataTables/TableTools/issues/72.

jhfrench commented 9 years ago

I do have three buttons (copy, excel, pdf). The tabletools documentation has 5 buttons, but calls the file 4 times (perhaps the "print" button doesn't invoke the flash file).

Even if this is the root of the multiple calls...is it necessary?

DataTables commented 9 years ago

The swf file is indeed loaded once for each button. The SWF file is the same for the buttons, and I've never understood why the are multiple requests for the same file... Browsers just seem not to cache it.

Hmmm - looking at my examples with Chrome, for some reason, Chrome is sending:

Cache-Control:max-age=0

That might explain the problem, but not why it is sending that... Need more investigation I think!

(meanwhile we raise a glass to the day in the future when we can get rid of the Flash dependency here...)

jhfrench commented 9 years ago

Cross-posted this to stackoverflow.com. Maybe one of those smart cookies can figure this out.