delayed keypress event 300ms
This commit is contained in:
parent
9b7cb585e3
commit
4db26a7d66
2 changed files with 24 additions and 13 deletions
12
jquery.table-filter.min.js
vendored
12
jquery.table-filter.min.js
vendored
|
@ -1,10 +1,2 @@
|
|||
/*
|
||||
* jQuery Plugin: Table Filter - version 0.1.1
|
||||
* http://github.com/hail2u/jquery.table-filter
|
||||
* Insert a input form for filtering table rows dinamically.
|
||||
*
|
||||
* Copyright (c) 2009 Kyo Nagashima <kyo@hail2u.net>
|
||||
* This library licensed under MIT license:
|
||||
* http://opensource.org/licenses/mit-license.php
|
||||
*/
|
||||
(function(a){a.fn.addTableFilter=function(d){var e=a.extend({},a.fn.addTableFilter.defaults,d);if(this.is("table")){if(!this.attr("id")){this.attr({id:"t-"+Math.floor(Math.random()*99999999)})}var g=this.attr("id");var f=g+"-filtering";var c=a("<label/>").attr({"for":f}).append(e.labelText);var b=a("<input/>").attr({id:f,type:"text",size:e.size});a("<p/>").addClass("formTableFilter").append(c).append(b).insertBefore(this);a("#"+f).keyup(function(h){var i=this.value.toLowerCase().split(" ");a("#"+g+" tbody tr").each(function(){var j=a(this).html().toLowerCase().replace(/<.+?>/g,"").replace(/\s+/g," ");var k=0;a.each(i,function(){if(j.indexOf(this)<0){k=1;return false}});k?a(this).hide():a(this).show()})})}return this};a.fn.addTableFilter.defaults={labelText:"Keyword(s): ",size:32}})(jQuery);
|
||||
(function(a){a.fn.addTableFilter=function(c){var b=a.extend({},a.fn.addTableFilter.defaults,c);if(this.is("table")){this.attr("id")||this.attr({id:"t-"+Math.floor(Math.random()*99999999)});var d=this.attr("id");c=d+"-filtering";var e=a("<label/>").attr({"for":c}).append(b.labelText);b=a("<input/>").attr({id:c,type:"text",size:b.size});a("<p/>").addClass("formTableFilter").append(e).append(b).insertBefore(this);a("#"+c).delayBind("keyup",function(){var h=a(this).val().toLowerCase().split(" ");a("#"+
|
||||
d+" tbody tr").each(function(){var f=a(this).html().toLowerCase().replace(/<.+?>/g,"").replace(/\s+/g," "),g=0;a.each(h,function(){if(f.indexOf(this)<0){g=1;return false}});g?a(this).hide():a(this).show()})},300)}return this};a.fn.addTableFilter.defaults={labelText:"Keyword(s): ",size:32};a.fn.delayBind=function(c,b,d,e){if(a.isFunction(b)){e=d;d=b;b=undefined}var h=this,f=null;return this.bind(c,b,function(g){clearTimeout(f);f=setTimeout(function(){d.apply(h,[a.extend({},g)])},e)})}})(jQuery);
|
Loading…
Add table
Add a link
Reference in a new issue