Thanks @pjdarch & @stevevance - your combined solution is working perfectly for me. This issue has been nagging at me for a while so it was nice to finally find a fix.
The selector $('.dataTables_filter input[aria-controls="' + tableId + '"]') of @stevevance can return zero due to server reponse delays, not applying the desired behaviour. I would call $.fn.dataTable.Debounce within initComplete
@lukegong
Your solution works fine here (v. 1.10.23 ). I inserted one condition to reset search and reload all table data when input is blank. I uncommented if statement and change this condition on line 13 including this command: searchTerm.length == 0
Answers
Nice one! Would you be willing to send that as a pull request here?
Allan
Thanks @pjdarch & @stevevance - your combined solution is working perfectly for me. This issue has been nagging at me for a while so it was nice to finally find a fix.
The selector
$('.dataTables_filter input[aria-controls="' + tableId + '"]')
of @stevevance can return zero due to server reponse delays, not applying the desired behaviour. I would call$.fn.dataTable.Debounce
within initComplete@lukegong
Your solution works fine here (v. 1.10.23 ). I inserted one condition to reset search and reload all table data when input is blank. I uncommented if statement and change this condition on line 13 including this command: searchTerm.length == 0
if(searchTerm.length == 0 || searchTerm.length >= 3 || e.keyCode == 13) {
I added a common input text and call .draw(); manually.