我正在使用 codeigniter 框架来构建我的 Web 应用程序。我需要将我的表从数据表导出到 csv 和 excel。但是在数据表 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
]
});
});
当我使用 codeigniter 时,我已将媒体文件放置在放置所有 jquery css 文件的相同位置
//codegen
// media
// css
// jquery
它显示复制、Excel、打印按钮但不起作用。但是当我单击 Excel 按钮时,仍然没有发生任何事情。我的错是什么?
还,
我无法猜测为什么在加载 sSwfPath 时出现 404 错误?
请让我知道是否有任何遗漏或我是否在任何地方错了..
这会有很大帮助。
提前致谢