Hi,
> I've just released a brand new plug-in called quickSearch, for filter
> large sets of data. Any comments, criticism (constructive, of course!)
> and faults would be greatly received!
>
> http://rikrikrik.com/jquery/quicksearch/
Very usefull. Some Ideas to improve this:
1. Create the input field dynamically. Then your content only holds the table
and no element that is useless without JavaScript enabled. I.e. make it less
obtrusive.
2. For my way of thinking with jQuery the function should be called for the
container holding the elements that are searched:
$('#country').quicksearch({delay:42});
3. Let the user of your function provide an optional comparison callback. That
way you could e.g. only search for phone-numbers in your table:
$('#contacts').quicksearch({delay:42, compare:function(input) {
return ( $('td.phonenumber',this).text().indexOf(input) >= 0 );
} });
4. It would be cool to have it for remote lists as well. E.g.:
$('#contacts').quicksearch({delay:42, search:function(input) {
this.load('http://www.example.com/search.php?s='+urlencode(input));
} });
The default for these two function could be something like this:
var options = {
search: function(input) {
this.show().each(function() {
if( !options.compare.call(this,input) )
$(this).hide();
});
}
compare: function(input) {
return ( $(this).text().indexOf(input) >= 0 );
}
}
Christof
_______________________________________________
jQuery mailing list
[email protected]
http://jquery.com/discuss/