【发布时间】:2016-01-22 23:36:33
【问题描述】:
我一直在研究一些能够做到这一点的 jQuery 插件。我决定使用http://www.jqueryscript.net/table/Export-Html-Table-To-Excel-Spreadsheet-using-jQuery-table2excel.html 的那个,并尽可能地遵循它的说明。我一直在测试这个插件,但每次我点击按钮导出时,什么都没有发生。该表是使用 PHP(从 MySQL 服务器中提取数据)填充的,以下是我目前使用的脚本。
<script>
$(document).ready(function() {
//activate footable jquery plugin (this is the dynamic table on the report page with search and sorting functions)
$('.footable').footable();
});
//Prepare table2excel plugin (clicking the export button will send the main table to an Excel spreadsheet)
$("button").click(function(){
$(".footable").table2excel({
//Exclude CSS class specific to this plugin
exclude: ".noExl",
name: "Excel Document Name"
});
});
</script>
添加新代码后,footable 的显示完全没有改变。我能做些什么?我一直在想我只是放错了 table2excel 块,但即使我把它放在 ready(function(){}) 块内,什么也没发生。
【问题讨论】:
-
浏览器控制台是否显示错误?
-
不,什么都没有。
-
当它应该在里面时,它肯定在就绪块之外。在单击处理程序中放置警报或控制台登录以查看它是否正在触发
标签: javascript jquery html excel