Created
October 31, 2020 10:22
-
-
Save mtvbrianking/fe1760b85bd096115ac151cdec1f0259 to your computer and use it in GitHub Desktop.
jQuery filter on return
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$.extend(true, $.fn.dataTable.defaults, { | |
initComplete: function(settings, json) { | |
var api = this.api(); | |
var dtFilter = $.fn.dataTable.settings[0].aanFeatures.f; | |
var dtFilterInput = $('input', dtFilter); | |
dtFilterInput.unbind(); | |
/* | |
dtFilterInput.bind('keyup', function (event) { | |
if (event.keyCode == 13) { | |
api.search(this.value).draw(); | |
} | |
}); | |
*/ | |
// Usually the filter is of type search => input[type=search] | |
dtFilterInput.bind('search', function (event) { | |
api.search(this.value).draw(); | |
}); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment