Created
November 26, 2015 06:39
-
-
Save yajra/5b6721e2023386bbc4ac to your computer and use it in GitHub Desktop.
DataTables fnFilterOnReturn plugin
This file contains 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
jQuery.fn.dataTableExt.oApi.fnFilterOnReturn = function (oSettings) { | |
var _that = this; | |
this.each(function (i) { | |
$.fn.dataTableExt.iApiIndex = i; | |
var $this = this; | |
var anControl = $('input', _that.fnSettings().aanFeatures.f); | |
anControl | |
.unbind('keyup search input') | |
.bind('keypress', function (e) { | |
if (e.which == 13) { | |
$.fn.dataTableExt.iApiIndex = i; | |
_that.fnFilter(anControl.val()); | |
} | |
}); | |
return this; | |
}); | |
return this; | |
}; | |
$(function () { | |
$('.dataTables_wrapper table').dataTable().fnFilterOnReturn(); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment