Question for initComplete
Question for initComplete
Alexol
Posts: 11Questions: 4Answers: 0
Hello,
Excuse my english, but I didn't quite understand how "initComplete" works
Related this post : https://datatables.net/forums/discussion/43209
I've a problem with language.url (french) and this : https://datatables.net/examples/api/multi_filter
So Allan said "initComplete" but I don't understand... This is my code
<script type="text/javascript">
$(document).ready(function() {
// Setup - add a text input to each footer cell
$('#table_datatable tfoot th').each( function () {
var title = $(this).text();
$(this).html( '<input type="text" placeholder="Chercher '+title+'" />' );
} );
// DataTable
var table = $('#table_datatable').DataTable({
initComplete: function(settings, json){
language: {url: "//cdn.datatables.net/plug-ins/1.10.16/i18n/French.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();
}
} );
} );
} );
</script>
Search is OK but still english... Thank you
This discussion has been closed.
Answers
Did you read these two threads Allan posted ini the forum link you provided?
https://datatables.net//forums/discussion/comment/107640/#Comment_107640
https://datatables.net//forums/discussion/comment/86245
The second thread has the answer. Move your language option out of initCompelte and place your code to "Apply the search" in initComplete.
Kevin