datatable tools copy, pdf. csv, excel export didnt work. only print is working

十年热恋 提交于 2019-12-03 00:31:44

问题


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:


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.



来源:https://stackoverflow.com/questions/31197385/datatable-tools-copy-pdf-csv-excel-export-didnt-work-only-print-is-working

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!