Catch Export to Excel onclick event
Catch Export to Excel onclick event
Link to test case:
Debugger code (debug.datatables.net):
Error messages shown:
Description of problem:
Hi
I have over 15K records (12 columns each row) to export to Excel and it seems datatable's built-in export to Excel can't handle it. I have a third party server-side export to Excel that I want to use but can't seem to be able to catch the click event to prevent default action. I can always exclude export the Excel from button group and add an additional button to handle the exporting but it looks ugly to have two buttons.
In $(document).ready() I tried both of these and
$(".buttons-excel").on('click', function (event) {debugger
event.preventDefault();
// Do my own export
});
$(".buttons-excel").click(
function (event) {debugger
event.preventDefault();
// Do my own export
}
);
What am I doing wrong? I am using 1.10.22 version.
This question has an accepted answers - jump to answer
Answers
Maybe you can create a custom button like this example to perform your export.
Kevin
Thank you @kthorngren . So, I guess it is not possible to catch excelHtml5 buttons click event, right?
So, can I then have something like:
Because I tried this and 'My Excel Button' does not show up.
Never mind, operator error!
Thanks for the update. Good to hear you've got it working.
Allan