How to reload datatable with ajax as a source when the input is "cleared"
How to reload datatable with ajax as a source when the input is "cleared"
svajone
Posts: 3Questions: 2Answers: 0
So right now I have this code snippet that fires the search when more than 3 characters are pressed:
$(".filter").on("keyup change", function () {
//clear global search values
if(this.value.length >= 3) {
// Call the API search function
vendorListTable.search("");
vendorListTable.column($(this).data('columnIndex')).search(this.value).draw();
}
// Ensure we clear the search if they backspace far enough
if(this.value == "") {
vendorListTable.search("");
vendorListTable.search("").draw();
}
});
However, when I clear the field either by pressing backspace or cutting the value datatables won't reload. Any ideas as to how this is achieved?
This discussion has been closed.