Reputation: 317
requestsTable = $('#reportTable').dataTable({
sDom: 'T<"clear">lfrtip',
iDisplayLength: 10,
aLengthMenu: [[10, 20, 50, 100, -1], [10, 20, 50, 100, "All"]],
tableTools: {
sRowSelect: "os",
sSwfPath: "TableTools/swf/copy_csv_xls_pdf.swf",
aButtons: [
{
sExtends: "collection",
sButtonText: "Save",
sButtonClass: "save-collection",
aButtons: [ 'copy', 'xls' ]
},
'print'
]
}
});
requestsTable.fnSetColumnVis( 22, false );
requestsTable.fnSetColumnVis( 23, false );
when exported i get the data for the columns 22 and 23 but not their column headers...
html part code is :
<table id="reportTable" class="table table-striped table-bordered" width="100%" cellspacing="0">
<thead>
<tr style="font-size: smaller;">
<th>Request Id</th>
<th>Request<br />Type</th>
<th>...</th>
...
...
so on.....
</tr>
</thead>
<tbody>
<tr>
<td>105</td>
<td>evt</td>
...
...
so on......
</tr>
</tbody>
</table>
would like to have all data exported along with the hidden columns...
Upvotes: 1
Views: 1598
Reputation: 1
Define all your columns headers in the table, load all of them in the jquery script but only show columns of your choice using "visible":true/"visible":false.
This will export all columns including the invisible columns with their headers.
Upvotes: 0