riklomas / quicksearch

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

Solution for searching in multiple columns #45

Open a3020 opened 12 years ago

a3020 commented 12 years ago

The default testQuery checks each character of the query on a stripped string of a table row. This resulted in unwanted behavior in my table that shows ID's, full dates and other numbers. If you want to search on search chunks, use this function:

'testQuery': function(query, txt, _row){
    var arr = query.toString().split(" ");
    for (var i = 0; i < arr.length; i += 1) {
        if (txt.indexOf(arr[i]) === -1) {
            return false;
        }
    }
    return true;
}