Reputation: 1293
I am using dataTables (http://www.datatables.net/release-datatables/media/js/jquery.dataTables.js) & tableTools (http://www.datatables.net/release-datatables/extensions/TableTools/js/dataTables.tableTools.js & http://www.datatables.net/release-datatables/extensions/TableTools/css/dataTables.tableTools.css) and displaying a table and want to print it. But am having problems with the same.
Here are my options
$("#reportTableId").DataTable({
"paging": false,
"ordering": false,
"info": false,
"sDom": 'Tlrt',
"iDisplayLength": 100,
tableTools: {
"sSwfPath": "../ed1/static/swf/copy_csv_xls_pdf.swf",
"aButtons": [
{
"sExtends": "collection",
"sButtonText": "Save",
"aButtons": [
{
"sExtends": "xls",
"sTitle": $Name
},
{
"sExtends": "pdf",
"sTitle": $Name
}
],
"mColumns": [0, 1, 2],
"sPdfOrientation": "landscape"
},
{
"sExtends": "print",
"mColumns": "visible"
}
]
}
});
My report html structure is in the following format
<table id="reportTableId">
<tr>
<th class="tg-031e" colspan="2"></th>
</tr>
<tr>
<td class="tg-031e"></td>
<td class="tg-031e"></td>
</tr>
<tr>
<td class="tg-031e"></td>
<td class="tg-031e"></td>
</tr>
<tr>
<td class="tg-031e"></td>
<td class="tg-031e"></td>
</tr>
<tr>
<td class="tg-031e"></td>
<td class="tg-031e"></td>
</tr>
<tr>
<td class="tg-031e"></td>
<td class="tg-031e"></td>
</tr>
<tr>
<td class="tg-031e"></td>
<td class="tg-031e"></td>
</tr>
<tr>
<td class="tg-031e"></td>
<td class="tg-031e"></td>
</tr>
<tr>
<td class="tg-031e"></td>
<td class="tg-031e"></td>
</tr>
<tr>
<td class="tg-031e"></td>
<td class="tg-031e"></td>
</tr>
<tr>
<td class="tg-031e"></td>
<td class="tg-031e"></td>
</tr>
<tr>
<td class="tg-031e"></td>
<td class="tg-031e"></td>
</tr>
<tr>
<td class="tg-031e"></td>
<td class="tg-031e"></td>
</tr>
<tr>
<td class="tg-031e" colspan="2"></td>
</tr>
<tr>
<td class="tg-031e"></td>
<td class="tg-031e"></td>
</tr>
</table>
css
.tg-031ea {
width: 15%;
}
Any help would be much appreciated.
HTML output:
PDF output: (only the heading column)
Upvotes: 1
Views: 1136
Reputation: 1461
Hope this is not too late, from my previous experience, I have learnt that Datatables requires valud HTML table, so having a colspan in your table does not help.
Upvotes: 1