Individual column searching with default param returned empty result!
Individual column searching with default param returned empty result!
pws2018
Posts: 1Questions: 1Answers: 0
i try this code to set in footer for each column separated search input, it's work when i not set default param but is returned empty result when i set the default ordring and language! why?!
$(document).ready(function() {
$('#default_order tfoot th').each( function () {
var title = $(this).text();
$(this).html( '<input type="text" placeholder="Cerca '+title+'" />' );
} );
var table =$('#default_order').DataTable({
"order": [
[0, "desc"]
],
"language": {
"url": "//cdn.datatables.net/plug-ins/1.10.15/i18n/Italian.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
This thread will answer your question:
https://datatables.net/forums/discussion/comment/128213/#Comment_128213
I put your code in this test case and it works when using
initComplete
.http://live.datatables.net/jixomoxe/1/edit
Kevin