I am encountering a slight issue while working on creating a table using Datatable and Bootstrap 4. Everything seems to be functioning well, but I have hit a snag. I am attempting to add a totalizer so that the sum of one or more columns is displayed at the end of the table. The code calculates the total correctly; however, it displays the total in the header rather than the footer. Any idea why this might be happening? Thank you.
echo '<div class="card-body"><table id="html5-extension" class="table table-hover table-striped " style="width:100%">';
echo '<thead class=""><tr role="row">
<th >'.$palabra['numeroor'].'</th>
<th >'.$palabra['serieano'].'</th>
<th >'.$palabra['taller'].'</th>
<th >'.$palabra['fecha'].'</th>
<th >'.$palabra['matricula'].'</th>
<th >'.$palabra['vehiculo'].'</th>
<th >'.$palabra['cristalroto'].'</th>
<th >'.$palabra['compania'].'</th>
<th ></th>
<th></th>
</tr> </thead>';
echo ' <tfoot>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
</tfoot>
<tbody>';
echo '<tr role="row">
<td scope="row">'.$lisc['or_interna'].'</td>
<td scope="row">'.$lisc['serie_or'].'/'.$lisc['ano_or'].'</td>
<td >'.$datostaller->nombre.'</td>
<td >'.cfecha($lisc['fecha_entrada']).'</td>
<td >'.$lisc['matricula'].'</td>
<td >'.$marca.$espacio.$modelo.'</td>
<td >'.$arraydano['nombre'].'</td>
<td >'.$cia->nombre_comercial.'</td>
';
my js code:
<script>
//#html5-extension
$(document).ready(function () {
$('#html5-extension tfoot td').each(function () {
var title = $(this).text();
$(this).html('<input type="text" placeholder="Filter.." />');
});
var table = $('#html5-extension').DataTable({
"dom": 'B<"float-left"i><"float-right"f>t<"float-left"l><"float-right"p><"clearfix">',
"responsive": false,
...
});
</script>
I edit. I have the following code so that the search engines appear at the top (instead of at the bottom). I know that's why the total comes out at the top, what I don't know is how to fix the total at the bottom and the search engines at the top
<style>
#html5-extension tfoot input {
width: 100% !important;
}
#html5-extension tfoot {
display: table-header-group !important;
}
</style>