1
我正在使用codeigniter框架构建我的web应用程序。我需要将我的表从数据表导出到csv和excel。Datatables TableTools - 无法找到sSwfPath的路径
我已经包括以下库:
<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>
我的jQuery的数据表如下:
$(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
]
});
});
正如我不过,虽然在数据表TableTools加载sSwfPath我得到一个错误我正在使用codeigniter我已经把我的媒体文件放在我已经放置了我所有的jquery css文件的地方
//codegen
// media
// css
// jquery
其显示复制,Excel,打印按钮,但不工作。 但仍然当我点击Excel按钮时,什么都没有发生。我的错是什么?
此外,
我不能去猜测为什么我收到404错误而载入sSwfPath?
请让我还是知道的,如果有什么缺失是否我错了,任何地方..
这将是很大的帮助。
由于提前
请让我知道什么是缺少..是否有任何我需要设置的环境变量或什么..? – NealCaffrey 2013-04-04 06:01:23
当我将这个值用于sSwfPath时,我自己的问题消失了:'http://datatables.net/release-datatables/extras/TableTools/media/swf/copy_csv_x ls_pdf.swf'(我在这里发布了这个解决方案:http:/ /stackoverflow.com/a/17676124/888177) – Stefan 2013-07-16 12:13:08