How to add a new row which is exportable
How to add a new row which is exportable

Hey guys, I am generating a grid from the backend and then adding 2 rows to it via jQuery.
Following this, I am applying DataTable() to my table.
The table renders correctly, however, when I try to export it to Excel/PDF/CSv/Other, it does not export the 2 rows I added via Jquery.
Any suggestions why? Code as below:
//add 2 columns in thead
$("#dgResults thead").prepend('<tr><th colspan=' + colcount + '>' + $("#lblLocations").text() + '</th></tr><tr><th colspan=' + colcount + '>' + $("#lblQuestionnaire").text() + '</th></tr>');
var table = $("#dgResults").DataTable(
{
"paging": true,
"lengthChange": true,
"pageLength": 25,
"bSort": false,
dom: 'lBfrtip',
buttons: ['copy', 'csv', 'excel', 'pdf', 'print']
});
This question has accepted answers - jump to:
This discussion has been closed.
Answers
Looks like you are adding two rows to the
thead
. Datatables only supports exporting one table header row.Kevin
Yup - for the moment. We are working on addressing that, but its a long term thing.
Allan
Great, thank you for that. I will think up a workaround.