2

I've been struggling with this for two days. I've posted on the datatables forum but I've gotten no response so I'm hoping the community here can help. I've read similar posts on this issue here but I'm already using the correct path for sSwf as many posts suggest.

The export buttons appear and all resources are loaded. However, Clicking the buttons has no action. There are no errors on the console.

<script>
$(document).ready(function() {
    $('#example').DataTable( {
        dom: 'T<"clear">lfrtip',
        tableTools: {
            "sSwfPath": "http://cdn.datatables.net/tabletools/2.2.2/swf/copy_csv_xls_pdf.swf"
            }
    } );
} );
</script>

Here is a JSFiddle with my code: http://jsfiddle.net/h2bof5cr/2/

fillup
  • 118
  • 4

1 Answers1

1

Your code is correct and matches the TableTools example. The issue is related to loading external SWF file, it doesn't work when code is loaded in <iframe> (as in your JSFiddle example) or when loaded from file on your computer using file:// protocol due to security restrictions.

The solution is to upload your code to a web server and it should work without any changes.

Alternatively, if you want it to work locally on your computer, you need to use relative path to copy_csv_xls_pdf.swf. For example save copy_csv_xls_pdf.swf along with your page and use "sSwfPath": "copy_csv_xls_pdf.swf".

Gyrocode.com
  • 57,606
  • 14
  • 150
  • 185
  • This is nearly correct. Even adding the file locally as you suggest does not have the correct permissions for the .swf to run. Using Macromedia "Global Security Settings panel" and selecting always allow works when the file is loaded locally. Thank you for your answer! – fillup Apr 27 '15 at 00:23