datatable tools copy, pdf. csv, excel export didnt

2019-03-06 18:00发布

im using datatables for my front end requirements and it works good except im having an issue in exporting stuff e.g. copy, csv, excel and pdf, only print is working. Any ideas, clues, thoughts, help, suggestions, recommendation? I'm using version 1.10.6

I did link all the necessary libraries e.g. datatables js, css and datatables tools js. Below is my code for activating it on my script

$('#cigptable').DataTable( {
            "pagingType": "full_numbers",
            "dom": 'T<"clear">lfrtip',
            "tableTools": {
                "sSwfPath": "../../../plugins/datatables/extensions/TableTools/swf/copy_csv_xls_pdf.swf"
            },
            "oLanguage": {
            "oPaginate": {
              "sPrevious": '<i class="ion-ios-arrow-left"></i>',
              "sNext": '<i class="ion-ios-arrow-right"></i>'
            }
          }
}); 

1条回答
Summer. ? 凉城
2楼-- · 2019-03-06 19:04

See sSwfPath option documentation, below is an excerpt:

sSwfPath Define the path of the SWF to be used by TableTools for copy to clipboard and saving a file locally operations. If you are having problems with these operations, but not printing, this is very likely to be the issue.

Most likely the problem is because of the incorrect path to the copy_csv_xls_pdf.swf file. Try to use CDN link instead:

//cdn.datatables.net/tabletools/2.2.4/swf/copy_csv_xls_pdf.swf

Quoting Allan Jardine, developer of DataTables:

Also, it won't work from a local drive, unless you have a security exception set up for Flash. You can change the Global Security Settings here: http://www.macromedia.com/support/documentation/en/flashplayer/help/settings_manager04.html.

查看更多
登录 后发表回答