Skip to content

Instantly share code, notes, and snippets.

View manozzreddy's full-sized avatar

Manoj Reddy manozzreddy

View GitHub Profile
@wardpeet
wardpeet / datatables_search.js
Created October 25, 2013 14:05
Trigger datatable search when user stops typing By default datatables filters by keypress (to be specific keyup event) Based on http://stackoverflow.com/questions/14042193/how-to-trigger-an-event-in-input-text-after-i-stop-typing-writting
// INITIATE DATATABLE
$(this).dataTable();
// Change the behaviour of datatables filter (wait until user stops typing)
var $filterBox = $(this).parents('.dataTables_wrapper').find('.dataTables_filter input')
, handlers = $.extend({}, $._data($filterBox[0], 'events')['keyup']); // Clone the object
// Remove all keyup methods, we will run them later
$filterBox.off('keyup')