DJ_cascurity
DJ_cascurity

Reputation: 57

Refresh DataTable after search

I have a table with several columns loaded from the DB, I applied a filter to be able to load only the wo's closed, but when I apply to look for the wo's open nothing appears.

Maybe I have to do a reload in the datatable?

$("#close").click(function(){
  var table = $('#todolist').DataTable();
  table.columns([2,3]).search("W.O.", "Close").draw();
});

$("#open").click(function(){
  var table = $('#todolist').DataTable();
  table.columns([2,3]).search("W.O.", "open").draw();
});

I tried to use $('#pedidos').DataTable().ajax.reload(); but it didn't work.

Upvotes: 0

Views: 3104

Answers (1)

karan
karan

Reputation: 482

$("#open").click(function(){
  $("#todolist").DataTable().draw();
});

Use this function wherever you want to refresh the datatable.

Upvotes: 1

Related Questions