html5 buttons export doesn't exclude the Header Colums
html5 buttons export doesn't exclude the Header Colums

i have a dynamic dataTable function to do a export with
exportOptions: {
columns: 'th:not(.noexportar)',
format: {
body: function (data, row, column, node) {
data = jQuery('<p>' + data + '</p>').text();
return jQuery.isNumeric(data.replace(',', '.')) ? data.replace(',', '.') : data;
}
}
},
But the Excel file keep the Header Column:
(POS) is the column that i dont wanna show in exports
How i can solve it?
This question has an accepted answers - jump to answer
This discussion has been closed.
Answers
You just need to drop the
th
from the selector, see here.Colin
in the editor Work perfectly, but not in my PC editor,
When i donwloaded Datatable i compile all files and thats is i had:
/*
* This combined file was created by the DataTables downloader builder:
* https://datatables.net/download
*
* To rebuild or modify this file with the latest versions of the included
* software please visit:
* https://datatables.net/download/#bs4/jszip-2.5.0/pdfmake-0.1.36/dt-1.10.20/af-2.3.4/b-1.6.1/b-colvis-1.6.1/b-flash-1.6.1/b-html5-1.6.1/b-print-1.6.1/cr-1.5.2/fc-3.3.0/fh-3.1.6/kt-2.5.1/r-2.2.3/rg-1.1.1/rr-1.2.6/sc-2.0.1/sl-1.3.1
*
* Included libraries:
* JSZip 2.5.0, pdfmake 0.1.36, DataTables 1.10.20, AutoFill 2.3.4, Buttons 1.6.1, Column visibility 1.6.1, Flash export 1.6.1, HTML5 export 1.6.1, Print view 1.6.1, ColReorder 1.5.2, FixedColumns 3.3.0, FixedHeader 3.1.6, KeyTable 2.5.1, Responsive 2.2.3, RowGroup 1.1.1, RowReorder 1.2.6, Scroller 2.0.1, Select 1.3.1
*/
Can be the version?
No, as this is using the same versions as you: http://live.datatables.net/zacevala/3/edit and it still works.
Can you modify that example so that it's more like your environment and demonstrates the issue, or could you link to your page.
Colin
I'm downloading the latest version of DaTatables (concatenate), but i need add the code to export double header in Excel (can be this what is wrong?)
Is the code to add Extra Header (is table two or more rows in header), it break the colum hiiding when export...
Quite possibly, it's in the same area. Try removing that code and see if it starts working.
Colin
It works without the code for multiple headers, the problem is i need export multiple headers/footers and the posibility to exclude any colum
That's not currently supported, I'm afraid, hence the reason why you're modifying the libraries. It is on our roadmap, not a high priority, but it is on there. I've added this thread to the case (DD-1332) so that you'll be notified when it's addressed.
Colin
Thanks for the Help, howerver i will try to do by myself because i really need it...
My job depends of that
The example I have in this thread may help. The example shows how to export child detail rows but you can use it as a basis for what you want. Basically it manually builds the rows being exported so you can export the extra header rows the add each of the table rows.
Kevin
Thanks Kevin, i'll try to understand your code to manipulate it to the extra header rows.
Juan
I edited the datatable Lib, add custom function to get the full Header and the footer, making colspan, group work in the export to Excel, PDF and Print...
Hope you can add these features in the future...
Glad you got it going. If they were straightforward changes, we'd be happy to receive a pull request for them if you're happy to share.
Colin
How i can show the code? here?
A pull request to the repo here would be welcome. The github docs detail how you can create a pull request.
Regards,
Allan