/ / DataTables JS / TableTools JS - exportando e imprimindo - jquery, datatables, tabletools

DataTables JS / TableTools JS - exportando e imprimindo - jquery, datatables, tabletools

Estou usando 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 E http://www.datatables.net/release-datatables/extensions/TableTools/css/dataTables.tableTools.css) e exibindo uma tabela e deseja imprimi-la. Mas estou tendo problemas com o mesmo.

Aqui estão minhas opções

 $("#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"
}
]
}
});

Minha estrutura de html de relatório está no seguinte formato

    <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%;
}
  1. Quando eu tento exportar para o Excel, eu obtenho apenas as colunas 1, não pegue o segundo;
  2. No Excel, nenhuma cor de célula é exportada
  3. Em PDF, recebo apenas 1 saída de página, pois o relatório HTML tem 13 páginas. Eu tentei incluir colunas, mas sem sucesso.

Qualquer ajuda seria muito apreciada.

Saída HTML: Instantâneo em HTML

Saída em PDF: (apenas a coluna do cabeçalho) saída em pdf

Respostas:

1 para resposta № 1

Espero que isso não seja tarde demais, a partir da minha experiência anterior, eu aprendi que o Datatables requer valud HTML table, então ter um colspan na sua tabela não ajuda.