riklomas / quicksearch

A jQuery plugin for searching through tables, lists, etc quickly
http://www.lomalogue.com/jquery/quicksearch/
680 stars 261 forks source link

Hide all rows when search input is empty #38

Open interglobe opened 12 years ago

interglobe commented 12 years ago

It would be nice to have a mode where all rows are hidden if the search input box is empty.

Forgive me if this is already possible. I'm still a bit of a n00b. I can't figure out how to do this with the current quicksearch.

webstar commented 12 years ago

Hi, I was after the same thing. Simply added an if statement in this code block that starts on line 43:

for (var i = 0, len = rowcache.length; i < len; i++) {
if (val_empty) {                
    options.hide.apply(rowcache[i]);
    noresults = false;
} else if (options.testQuery(query, cache[i], rowcache[i])){
    options.show.apply(rowcache[i]);                
    noresults = false;          
} else {
    options.hide.apply(rowcache[i]);
}

}