TableExport
TableExport copied to clipboard
Download function for custom buttons when exportButtons is false
Hi, Thanks for your work on this plugin, I'd like to generate the export buttons myself, I have set exportButtons to false and have made my buttons the way I want them, however I searched the docs and didn't find the function to call on the click event to download the data ?
Any help is appreciated
Try this:
var instance = $("#ranklist-table").tableExport({
formats: ['xlsx'],
exportButtons: false
});
var exportData = instance.getExportData()['ranklist-table']['xlsx'];
$("#export-ranklist").click(function () {
instance.export2file(exportData.data, exportData.mimeType, exportData.filename, exportData.fileExtension);
});
I like the solution. However, it does not work for dynamical tables. Basically replacing the event code with
$("#export-ranklist").click(function () {
instance.reset();
instance.export2file(exportData.data, exportData.mimeType, exportData.filename, exportData.fileExtension);
});
just does not work. I think that it might be connected with #99.