Dec 23, 2019
0
Level 1
Search DataTables
Hello,
When I want to perform a search in my table with DataTable, it works perfectly, except from the moment when I want to reset my settings for the language and for CSV / Excel export (so the comment part).
Can you help me on this?
Thank you
$('#liste-intervention tfoot th').each(function() {
let title = $(this).text();
$(this).html('<input type="text" class="form-control" placeholder="'+ title +'" />');
});
let table = $('#liste-intervention').DataTable({
// 'language': {
// 'url': '//cdn.datatables.net/plug-ins/1.10.20/i18n/French.json'
// },
// dom: 'Bfrtip',
// buttons: [
// 'csv', 'excel'
// ]
});
table.columns().every(function() {
let that = this;
$('input', this.footer()).on('keyup change clear', function() {
if(that.search() !== this.value) {
that
.search(this.value)
.draw();
}
});
});
Please or to participate in this conversation.