filtrado por columnas
filtrado por columnas

He implementado el filtrado por columnas con el siguiente codigo:
<
script>
$(document).ready(function(){
var table = $('#example').DataTable({
orderCellsTop: true,
fixedHeader: true
});
//Creamos una fila en el head de la tabla y lo clonamos para cada columna
$('#example thead tr').clone(true).appendTo( '#example thead' );
$('#example thead tr:eq(1) th').each( function (i) {
var title = $(this).text(); //es el nombre de la columna
$(this).html( '<input type="text" placeholder="Search...'+title+'" />' );
$( 'input', this ).on( 'keyup change', function () {
if ( table.column(i).search() !== this.value ) {
table
.column(i)
.search( this.value )
.draw();
}
} );
} );
});
</script>
pero me regresa el siguiente mensaje:
DataTables warning: table id=example - Cannot reinitialise DataTable. For more information about this error, please see http://datatables.net/tn/3
Pudieran ayudarme, por favor
This discussion has been closed.
Answers
That script looks OK, so we would need to see the issue occurring to be able to debug. Information on how to create a test case (if you aren't able to link to the page you are working on) is available here.
Cheers,
Colin