I created a datatable that filters on each column. Everything was fine until I updated my code trying to reset all filters. Here's my code:
$('.dt-column-search thead tr:eq(1) th').each(function(i) {
var title = $(this).text();
//another condition {
} else {
$(this).html(
'<button class="btn btn-danger btn-sm" id="resetFilter">reset</button>');
}
$('input, select', this).on('keyup change', function() {
if (dt_filter.column(i).search() !== this.value) {
dt_filter.column(i).search(this.value).draw();
}
});
});
var dt_filter = dt_filter_table.DataTable({
ajax: {
},
columns: [
],
orderCellsTop: true,
dom: '<"row"<"col-sm-12 col-md-6"l>><"table-responsive"t><"row"<"col-sm-12 col-md-6"i><"col-sm-12 col-md-6"p>>',
drawCallback: function() {
const resetFilter = document.querySelector('#resetFilter');
if (resetFilter) {
resetFilter.addEventListener('click', function() {
$('input[type="text"]').val('');
$('select').val('').trigger('change');
$('.flatpickr-input').each(function() {
if ($(this).hasClass('flatpickr-input')) {
this._flatpickr.clear();
}
});
dt_filter.columns().search('').draw();
dt_filter.ajax.reload(null, false);
});
}
}
});
The problem is that the table is not showing data as wanted when pressing the reset button see the image. 
Any help please!
datatabletag (e.g. by hovering your mouse over the tag) - and then follow the tag usage guidelines mentioned there.