Datatables TableTools - Not able to find the path for sSwfPath

孤街浪徒 提交于 2019-12-24 12:39:27

问题


I am using codeigniter framework to build my web application. I need to export my table from datatables to csv and excel. But I am getting an error while loading the sSwfPath in the datatables TableTools :

I have included the following libraries :

<script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script> 
<script src="http://localhost/codegen/assets/js/jquery.dataTables.js" type="text/javascript"></script>
<script src="http://localhost/codegen/js/jquery.dataTables.columnFilter.js" type="text/javascript"></script>
<script src="http://localhost/codegen/media/js/ZeroClipboard.js" type="text/javascript"></script>
<script src="http://localhost/codegen/media/js/TableTools.js" type="text/javascript"></script>

And my jquery datatables is as follows :

$(document).ready(function(){
    var oTable = $('#datatables').dataTable({
        "sPaginationType":"full_numbers",
        "sDom": 'Tlfrtip',
        "oTableTools": {
            "sSwfPath": "<?php base_url();?>/application/libraries/jQuery/media/swf/copy_cvs_xls_pdf.swf"  // 404 error - File not found
        },
        "sScrollX": "100%",
        "bScrollCollapse": true,
        "bAutoWidth": true,
        "aaSorting":[[0, "asc"]],
        "bJQueryUI":true
    }).columnFilter({
        aoColumns: [ null,
                     null,
                     { type: "select", values: [ 'male', 'female']  },
                     null,
                     null,
                     null,
                     null,
                     { type: "select", values: [ '1', '2', '3', '4', '5', '6', '7','8','9','10']  },
                     { type: "select", values: [ 'A', 'B', 'C']  },
                     null,
                     { type: "select", values: ['P', 'A'] },
                     null,
                     null,
                     null
            ]
    });
});

As I am using codeigniter I have placed my media file in the same place where I have placed all my jquery css files

//codegen
   // media
   // css
   // jquery

its showing Copy, Excel, Print button but not working. but still when i click on Excel button nothing is happening. what is my fault?

Also,

I am not able to guess why I am getting 404 error while loading sSwfPath ?

Please let me know if there is anything missing or whether I am wrong anywhere..

It would be of great help.

Thanks in Advance


回答1:


its not in the media folder. when you download the whole src code from datatables.net , it's in a folder name "extra", its in the same level as the media folder.



来源:https://stackoverflow.com/questions/15802470/datatables-tabletools-not-able-to-find-the-path-for-sswfpath

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