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