jQuery – List and Document Library Search Solution in SharePoint
Guest Author: Peter Allen
BitsOfSharePoint
Search has not been easy with SharePoint 2007 and especially with WSS 3.0. For example many times I just want to search list or document library. What I want is ability to see what items match what I’m looking for specifically with the list that is showing right now. I would like to search, not have to refresh the page or go to another location to do the search.
I have been developing another site with SharePoint WSS 3.0 and needed to have such a solution. The site www.mobilesitezone.net (this is designed for smartphones) is a very customized SharePoint site. I then adapted the search created for it to work with any SharePoint List or Document Library.
What was created was a jQuery search solution that only looked at the list on the page and filtered results based on the search criteria. It will search all the fields that are shown on the site and then show you the rows that have any matches.
Here is an example where there is a large list of over 400 items and then a search is made for "google" which then displays just the results.
List

Results

I have put together an example page where you can test this out and get the WebPart or Code for CEWP to add this to your site.
Click here to get the solution
Hope you enjoy,
Peter
Guest Author: Peter Allen
BitsOfSharePoint
Peter Allen is a SharePoint enthusiast and evangelist having deployed solutions in Healthcare, financial, and engineering firms. He has worked in the technology field for 15 years creating solutions both internally and externally for clients. He has worked at start-ups, mid and larger corporations and has consulted. He currently hosts a site http://www.bitsofsharepoint.com where he blogs about solutions to extend the features of SharePoint.
- jQuery - List and Document Library Search Solution in SharePoint
- jQuery – List and Document Library Filter Version 2.0 - Part 2
Nice article! Really simple and effective solution.
Good job Peter :)
Thanks for Sharing
Awesome Peter! Great presentation and THANK YOU for the webpart!
Pretty slick Peter though a bit slow on a list of 900+ items and 7 fields in the view. A progress bar or spinning icon could help.
I agree. I have been looking at ways to speed this up. I hope to have a second version out soon that will address this. MS did not make the tables simple with regards to list in SharePoint. There are a lot tables within tables and this has made it challenge.
Thank all for the feedback.
TG, I have an updated version that I think works faster. If you would like to test, please email me. You can get my contact info at my site, http://www.bitsofsharepoint.com.
Thanks,
Peter
Very slick, but is there a way to expand the scope of the search beyond the current page of items? I have a view that batches items by 100’s and would like to see results in the filter from the entire list, not just the items on the current page.
It’s a great solution regardless but I have some very large lists that would preclude the use of the solution as it exists now.
Yet again something that should have been an OOTB feature is plugged by a 3rd party genius ;)
Is there anyway to get this to work with dataview webparts created in Sharepoint designer?
Eric,
I understand your dilemma. Unfortunately this solution will not work for your scenario.
But I am working on a solution that may help you. It will be a different way to filter/search your list. This will be more involved solution since we will be looking at going beyond just filtering the viewable items in a list and this will require use of SharePoint Designer.
I hope to have this out shortly.
Tony,
Ubet. Since you have created a Data View Web Part (DVWP) there is a missing class that can be added to fix this. If you look at my code I am looking for tables that have a class called “ms-listviewtable”. OOTB Web Parts have this class added by default. DVWP when created do not get this class and so my solution does not find the table.
Easy fix: Add a class to the table element. If you look at the code for your DVWP (I like the split view in SharePoint Designer), look for the TH elements you will then see above them the table element. It will look something like this:
Notice there is no class listed at all. You will add class=”ms-listviewtable” to the table element. It should look like this:
That should fix it.
Hope that helps
Bingo! Thanks that works a treat. :)
Great webpart.. Definitely useful…
I did notice that if the items are groups and collapsed.. the filter does not work.. the list items need to be expanded before it can filter it…
Is this by design or something stupid on my side.?
Harsha,
There is nothing that you have done wrong. This is a feature that I hope to add in to later versions. For now the grouping needs to be expanded for it to work.
bitsofsharepoint.com is down…does anyone have a mirror to the script?
Andrew – I received an email from Peter. He’s aware of the problem and is working on it. Thanks for the heads-up. — Mark
Sorry all for the site being down. My provider has fixed the problem and we are back in business, YEAH!
cool solution!
Hello,
is there any chance to realize tgis on Sharepoint Foundation? Maybe someone done this already. On 2007 this is no Problem for me but since the Designer changes dramaticly i cant get this to work.
Thanks Mike
Hi Peter
i am using your search webpart
I configure as you mention . but when i put something on seach box and search it comes with blank page every time, nothing appears on data view web part page which i customize.
i checked i put right path in location box as well .it opens that page but nothing on it.
If you are using data view then you should use this solution. http://www.bitsofsharepoint.com/ExamplePoint/Site/ListSearchII.aspx