Hello,
My table has two header rows, DataTable is showing bother header rows but not exported to pdf please help.
My table is:
<table id="example" class="table table-striped table-sm table-bordered nowrap" style="width:100%">
<thead>
<tr><th colspan="2"><?php if(isset($session)){ echo $session; } ?> - <?php if(isset($class)){ echo $class; } ?>
- <?php if(isset($section)){ echo $section; } ?></th></tr>
<tr>
<th class="text-primary">Roll #</th>
<th class="text-primary">Student Name</th>
</tr>
</thead>
<?php if(isset($rows)) { ?>
<tbody>
<?php foreach($rows as $row) { ?>
<tr>
<td><?=$row['rollno'];?></td>
<td><?=$row['studentname'];?></td>
</tr>
<?php } ?>
</tbody>
<?php } ?>
</table>
DataTable Image
PDF Output
Please help, thanks in advance.
What I have tried:
$('#example').DataTable({
header: true,
dom: 'Blfrtip',
search: true,
iDisplayLength: 10,
lengthMenu: [
[ 10, 25, 50,100, -1 ],
[ '10 rows', '25 rows', '50 rows','100 rows', 'Show all' ]
],
buttons: [
'copyHtml5',
'excelHtml5',
'csvHtml5',
{
extend: 'pdfHtml5',
orientation: 'landscape',
pageSize: 'LEGAL'
}
]
});