I have a list of products with hundreds of entries. Each product has contact details with it as well as company information etc. I would like to be able to run a search on this list and return matches from any column.

For example, currently using a text query filter I am able to return results that match the exact term typed in from one particular column, but ideally I'd like it to return any record in which the query matches any column.

Is this possible?

  • 1
    Why not use site search? I you use the search box on the page of the list it searches the list.
    – Remko
    Commented Apr 25, 2013 at 13:24
  • I have considered this option, but the ideal scenario is filtering the list. Commented Apr 29, 2013 at 8:30

1 Answer 1


So, what we are going to do is add a short jQuery script on our page. This script will read the text in a text box and then filter all the rows in a list view and only show those rows that contain text that’s in the text box. To be more exact the script will:

1.Find the specific table we want to filter (don’t filter on EVERY row on the page, that would hurt performance).

2.Iterate through each row in that table.

3.Strip off the html tags (we don’t want those affecting our search results, and the speed of the string search)

4.Search the remaining text to see if the text in the filter box exists in what’s left

5.Hide/Show rows accordingly


<SCRIPT type="text/javascript"src="/Scripts/jquery.min.js"></SCRIPT>

<SCRIPT type=text/javascript>

    //attach a function to the keyup event on the filter box

//strip off html taqs
function stripHTML (field) {
    return field.replace(/<([^>]+)>/g,'');

function DynamicFilter(text)
    //find out list view (default class for a listview is "ms-listviewtable"
    $('table [class="ms-listviewtable"]').find('tr').each(function()
            //don't filter out the header row
            if ($(this).attr("class") != "ms-viewheadertr ms-vhltr")
                //get the html for the row and strip off the html tabs
                source = stripHTML($(this).html());

                //check to see if the filter text exists in the remaining text
                if (source.indexOf(text) < 0)
                    //hide the row if it doesn't contain the text
                } else {
                    //otherwise show it


<div id="mainDiv">
            <td class='Filter' width='125px'>Search: <input type="Text" id="filterInput" ></td>

you can use other methods like binding to the list and from the dataset ;) can be done quite easily but requires a bit of coding :)



Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.