1

I need to do a customized search for SharePoint. It needs to search in all the columns and rows of the list without having to select the column, in other words it cannot have filter. I cannot edit the master page of the SharePoint, search field needs to be added in a Content box. Now, I did manage to search but it does not search the entire list since it has paging. I have tried naming the class, the webpart and event calling the list by ID. How can I make it search ALL the columns and rows and display the results.

I've read I can use CSOM, JSOM or REST to extract the items in the list and query them, but I have found this a bit complicated to implement in this case.

The code needs to be simplified and deploy-able across the entire SharePoint site. Any input is very appreciated.

Here is part of my code for the .click() of the button:

 $("#btnSearch").click(function () {
        var param = $("#tbSearchBox").val();



        if (param != "") {


            var collapsedGroups = $("td.ms-gb img[src*='/_layouts/images/plus.gif']:visible");

            if (collapsedGroups.length > 0)
            {
                $("td.ms-gb img[src*='/_layouts/images/plus.gif']:visible").parent().click();
            }//will expand the collapsed groups

            searchResult = $("table.ms-listviewtable").find("td:contains('" + param + "')").parent();
            allRows = $("table.ms-listviewtable").find("td").parent();
            allRows.hide();
            searchResult.show();

        } //end of If
    });//end #btnSearch
  • important sidenote, SharePoint 2013 has this functionality built in. It works very well and seems like a perfect solution for you. If you're planning an upgrade anytime soon, I would simply wait instead of doing the extra development time. – Christoffel de Gruyter Aug 14 '14 at 21:23
  • Sadly, my client does not wish to use plug-ins and does not wish to upgrade to SP13 just yet. – Mary Lou Aug 15 '14 at 14:50
1

Search definitely seems like the most feasible solution for what you're looking for, what exactly is not working for you, paging should not have any effect on search results.

If you insist in using a customized solution, I would actually suggest using a javascript library that supports search functionality.

You can use the jQuery Datatables plugin and reformat your listview as a simple dataview in SharePoint designer. http://www.datatables.net

Tutorial: http://summit7systems.com/who-needs-a-data-view-web-part-sharepoint-rest-and-datatables-net/

  • Thank you, the library I am using is jquery-1.7.2.min.js, the issue relies on how the list has paging. I can use this same code on a none-paged list and it works like a charm. Sadly, my client does not wish to use plug-ins and does not wish to upgrade to SP13 just yet.Later I found this link: [stackoverflow.com/questions/19675644/…, do you think I can adjust this for my search? – Mary Lou Aug 15 '14 at 14:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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