Quantcast
Channel: Recent Discussions — DataTables forums
Viewing all articles
Browse latest Browse all 82311

How to reload datatable with ajax as a source when the input is "cleared"

$
0
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?


Viewing all articles
Browse latest Browse all 82311

Trending Articles