I've been looking into some jQuery plugins that are capable of doing this. I decided to use the one at http://www.jqueryscript.net/table/Export-Html-Table-To-Excel-Spreadsheet-using-jQuery-table2excel.html and I've followed its instructions as closely as possible. I've been testing this plugin but every time I click the button to export, nothing happens. The table is populated using PHP (which is pulling data from a MySQL server) and the following is the script I currently have in place.
<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>
The footable
display hasn't changed at all after I added the new code. What can I do? I keep thinking I've just misplaced the table2excel block but even when I had it inside the ready(function(){})
block, nothing happened.