When I enable Individual column searching I loose the hability to set options
When I enable Individual column searching I loose the hability to set options

Refering to: https://datatables.net/examples/api/multi_filter.html
If I set options to the datatable like:
// DataTable
var table = $("#datatable").DataTable( {
responsive: true,
paging: true,
"pageLength": 50,
"lengthMenu": [ [20, 50, 150, -1], [20, 50, 150, "All"] ],
"language": {
"url": "//cdn.datatables.net/plug-ins/1.10.13/i18n/Portuguese.json"
}
});
The Filtering from each column does not work
Only if I initialize the datatable like this :
var table = $("#datatable").DataTable();
Heres the full code.
$(document).ready(function() {
// Setup - add a text input to each footer cell
$('#datatable tfoot th').each( function () {
var title = $(this).text();
$(this).html( '<input type="text" placeholder="Search '+title+'" />' );
} );
// DataTable
var table = $("#datatable").DataTable( {
responsive: true,
paging: true,
"pageLength": 50,
"lengthMenu": [ [20, 50, 150, -1], [20, 50, 150, "All"] ],
"language": {
"url": "//cdn.datatables.net/plug-ins/1.10.13/i18n/Portuguese.json"
}
});
// Apply the search
table.columns().every( function () {
var that = this;
$( 'input', this.footer() ).on( 'keyup change', function () {
if ( that.search() !== this.value ) {
that
.search( this.value )
.draw();
}
} );
} );
} );
This discussion has been closed.
Answers
I came across this plugin last week that might make this all much simpler https://github.com/vedmack/yadcf It has been updated for the latest version of DataTables.
@allen had some kind words about this early on. Don't know if he still likes it.