我需要我的数据表将数据导出到excel文件,但我正在尝试使用datatables.net提供的示例。但是我的数据表没有响应该功能。我在这里发布我的代码:
<link rel="stylesheet" type="text/css" href="<%=request.getContextPath()%>/css/jquery.dataTables.css">
<link rel="stylesheet" type="text/css" href="<%=request.getContextPath()%>/css/dataTables.tableTools.css">
<link rel="stylesheet" type="text/css" href="<%=request.getContextPath()%>/css/metallic.css">
<link rel="stylesheet" href="<%=request.getContextPath()%>/css/jquery-ui.css">
<script type="text/javascript" language="javascript" src="<%=request.getContextPath()%>/js/jquery.js"></script>
<script type="text/javascript" language="javascript" src="<%=request.getContextPath()%>/js/jquery.dataTables.js"></script>
<script type="text/javascript" language="javascript" src="<%=request.getContextPath()%>/js/zebra_datepicker.js"></script>
<script type="text/javascript" language="javascript" src="<%=request.getContextPath()%>/js/dataTables.tableTools.js"></script>
<script type="text/javascript" src="http://code.jquery.com/ui/1.11.2/jquery-ui.js"></script>
<script src="<%=request.getContextPath()%>/js/highcharts.js"></script>
<script src="http://code.highcharts.com/modules/exporting.js"></script>
$('#mainTable').dataTable({
dom: 'T<"clear">lfrtip',
tableTools: {
"sSwfPath": "../swf/copy_csv_xls_pdf.swf"
},
"scrollY": 300,
"scrollCollapse": true,
"jQueryUI": true,
"aaSorting": [],
});
有人帮助我..
答案 0 :(得分:0)
tableTools: {
"sSwfPath": "../swf/copy_csv_xls_pdf.swf",
"aButtons": [
{
'sExtends':'xls',
"sFileName": "*.xls"
},
'csv','pdf','copy','print'
]
},
答案 1 :(得分:0)
我之前通过下载swf对象并将sswfpath引用到该位置来实现此功能。
Please check the fiddle and change the "sSwfPath"
with the location of the downloaded
copy_csv_xls_pdf shockwave flash object.
您可以从https://github.com/DataTables/TableTools/blob/master/swf/copy_csv_xls_pdf.swf
下载swf文件