Estoy realizando un filtrado con inputs en un datatable, también realizo en el datatable un ocultamiento de columnas, pero no esconde los inputs dentro del datatable, espero haya sido claro y me puedan ayudar, gracias.
Aqui el código de lo thead de mi tabla:
<div class=row>
<thead>
<tr>
<th>Documento</th>
<th>Fecha creacion</th>
<th>Descargar</th>
<th>Visualizar</th>
</tr>
</thead>
<thead class="filters">
<tr>
<td>Documento</td>
<td>Fecha creacion</td>
<td>Descargar</td>
<td>Visualizar</td>
</tr>
</thead>
</div>
Aqui los jquery:
$('#tabla_bajas .filters td').each( function () {
var title = $('#tabla_bajas thead th').eq( $(this).index() ).text();
$(this).html( '<input type="text" placeholder="Search '+title+'" />' );
} );
var table = $('#tabla_bajas').DataTable();
// Apply the search
table.columns().eq( 0 ).each( function ( colIdx ) {
$( 'input', $('.filters td')[colIdx] ).on( 'keyup change', function () {
table
.column( colIdx )
.search( this.value )
.draw();
} );
} );
$('#myCheck1').change(function() {
table.columns(0).visible(!$(this).is(':checked'))
console.log(table.columns(0));
});
$('#myCheck2').change(function() {
table.columns([1, 2]).visible(!$(this).is(':checked'))
})
En las funciones de los 2 checkbox quiero ocultar totalmente la columna junto con los inputs pero no lo hace.