Adding meta information above the table when exporting to Excel/CSV?
Adding meta information above the table when exporting to Excel/CSV?
Hello,
I have followed the guide here:
https://datatables.net/extensions/buttons/examples/initialisation/export.html
And I now have a table rendered with Excel/CSV buttons which work fine.
However, when exporting, I want to add a row above the table with some metadata e.g. the query they used to search my database (call it 'textQuery')
My JS code within my home.html file is currently:
<script>
$(document).ready(function () {
$('#table_id').DataTable({
dom: 'Brtip',
buttons: [
'copy', 'csv', 'excel']
});
});
</script>
I have looked at exportOptions, but I cannot see anything which does what I need, although I admit I am VERY new to this.
Any help would be much appreciated!
Answers
As always, as soon as one asks a question, one finds an answer. Thank you anyway:
You could do this for example:
Here is another example also including messageTop.
https://datatables.net/extensions/buttons/examples/html5/titleMessage.html