The CodePlex Corner: Instant List Filter

The link to the Instant List Filter is https://instantlistfilter.codeplex.com/

This edition of the CodePlex Column delves into the SharePoint Instant List Filter, a project that’s both highly rated and has attracted a significant number of votes. It boasts an impressive 20k+ download count (at the time of writing). It was developed by Jaap Vossers and has previously attracted the attention of Marc Anderson and Alexander Bautz (both well-known JavaScript experts). As the product name suggests, the solution provides filter text boxes on a list/library to allow a “filter-as-you-type” functionality. It also needs JQuery to work successfully when it is deployed. Having being around since 2009, it would be fair to say that the list filter is one of the community products that has stood the test of time.

So, if it has been around for a while, the first question that may spring to mind is; what’s the point in taking a look at it now? The simple answer is the changing SharePoint landscape. As with a few other projects that have been discussed in the CodePlex Corner, the environment that the list filter was born into is very different to the one that we, as SharePoint professionals, have now. Some of the noticeable differences include more powerful versions of SharePoint, newer HTML / CSS standards for each one and of course, very different browser habits to contend with. It’s in this light that an in-depth look at the utility in context of its altered environment might be useful.

A good place to start is to look at how the list filter code responds to the various versions of SharePoint still in use today. Whilst investigating, the opportunity to test the code against the popular browsers of the day also presents itself. The timeline below looks at the release dates of all these products.

Building such a timeline provides two distinct advantages: –

  1. Identifiable points in time at which we can check browsing habits
  2. A linear route to allow us to see which browsers that SharePoint and the list filter would be expected to work with

Cross referencing the most recent three dates from the timeline above with the W3Schools Browser statistics provides the following insights into browser trends at the time of release for each product. The most noticeable thing is the huge increase in Chrome usage and the sharp drop in how many users are sticking with Internet Explorer. Mozilla’s Firefox, despite losing almost a third of its user base between May 2010 and November 2012 does still remain the intermediate browser of choice.

Date

IE

Firefox

Chrome

Mar-09

43.30%

46.50%

4.20%

May-10

32.20%

46.90%

14.50%

Nov-12

15.10%

31.20%

46.30%

Aug-14

8.30%

24.70%

60.10%

Whilst these statistics are for overall browser usage and not specific to SharePoint utilisation, keeping these trends in mind is important as SharePoint doesn’t necessarily play nicely with non-Microsoft browsers. Some of the more unique SharePoint features (like these) are built in Active-X, a proprietary technology that only works in Internet Explorer. Knowing these limits when planning browser support around a SharePoint deployment is invaluable. Extending this line of thinking to third party products both commercial and open source should be seen as a wise investment.

Armed with an idea of the likely browser habits of your audience, a SharePoint professional will know where to begin assessing the list filter. Should the project not work in any of the browsers above, they can now work what the potential damage will be. Having deployed the list filter against several versions of SharePoint in the browsers listed above, the following behaviours were noted.

SP Version

IE

Firefox

Chrome

SharePoint 2007

Rendered

Didn’t render

Rendered

SharePoint 2010

Rendered

Didn’t render

Rendered

SharePoint 2013

Rendered

Didn’t render

Rendered

What these notes (as seen in the project forums here) show are that any FireFox user is not likely to see the list filter render to any SharePoint deployment that they may be visiting. As of August 2014 at 24.7% usability, that’s almost 1 in 4 of any user base, which is a significant number. (How to get the script working with Firefox is the companion tutorial for this article).

Moving on from this, knowing what versions of SharePoint the list filter works on is only one part of our journey. As Microsoft ships the product with several different list and library templates it would be easy to assume that if the List Filter works on one, it would work on all of them. To explore this assumption in greater detail, these templates were all tested. Please see the table below for the results. Please note that only a custom list was tested, not each specific list template packaged.

 

 

Template

Rendered

Worked

Custom List

Rendered

Yes

Asset Library

Didn’t render

No

Data Connection Library

Rendered

Yes

Document Library

Rendered

Yes

Form Library

Rendered

Yes

Record Library

Rendered

Yes

Wiki Page Library

Rendered

Yes

 

The last level that we can assess the list filter on is the column level. It provides a great freebie in that you can use it to filter on field types that normally aren’t filterable. This includes calculated columns and notes (multiple lines of text) fields.

Link to SharePointReviews.com product review

Currently there is no entry on http://www.sharepointreviews.com for the Instant List Filter.

“End User – Developer” scale

This tool fits squarely in in the End User part of the “End User – Developer” scale. The list filter is easily deployed to the client with little effort, from which point it pretty much becomes a “fire and forget” solution. There are several other ways to install the solution but the ability to copy and paste the code into a Content Editor Web Part makes this very accessible.

Potential pitfalls / problems

The instant list filter was originally developed for SharePoint 2007. This is the single biggest problem that IT professionals are likely to have with it. It can work with SharePoint 2010 / 2013 though. The issues that you are likely to experience with it are:-

  1. It only filters on returned item count and doesn’t go past pagination. For instance, if you have a list with 3000 items but have set pagination to 100 per page, the list filter only works on those 100 items.
  2. It also doesn’t work on external lists unless modified to do so.
  3. It doesn’t work very well with FireFox unless modified to do so.

Tutorials

Because the list filter is easy enough to get started with, an installation tutorial would be pointless. Instead, what we’ll look at is how to get the script working with FireFox, which appears to be problematic for some users.

Conclusion

When installed and operational the instant list filter looks and feels like it should have been part of the SharePoint product itself. It’s a classy and easy-to-use extension that complements the OOB search tools very well. The ability to filter on traditionally non-filterable field types is a big bonus. It does have its limitations however, with the most potent of these being that it only filters on the rendered page items NOT the entire list.

The links below are my reference list: –

  1. Original CodePlex Project Link: – https://instantlistfilter.codeplex.com/
  2. Jaap Vossers Blog – http://blog.vossers.com/
  3. Business Data List Web Part usage – https://instantlistfilter.codeplex.com/discussions/228167
  4. Visual Upgrade changes – https://instantlistfilter.codeplex.com/discussions/262132
  5. Filtering on just a single column – https://instantlistfilter.codeplex.com/discussions/257825
  6. 2010 Code – https://instantlistfilter.codeplex.com/discussions/49123
  7. W3C Browser Statistics & trends – http://www.w3schools.com/browsers/browsers_stats.asp
Advertisements

Yammer & Drop Box Integration

I meant to post something about this a few days ago but have only just gotten to it but an interesting and not entirely useful feature was added to Yammer recently.

Dropbox Integration.

If you click on the upload paper clip, you may have seen something like the above. A colleague of mine noticed this on our corporate instance so we asked our Customer Success Manager about it.

It seems that this is a test facility that’s only open to a few clients for an undetermined amount of time. I can no longer see this option as a Yammer Verified Admin but this doesn’t mean that others won’t see it on their own networks.

We didn’t see this as entirely useful due to the fact we want to push other collaboration tools within the company. It also seems odd that this was added before OneDrive Integration.

Building a list-specific search with JavaScript

Whilst writing an article that looks at the Instant List Filter (hosted on CodePlex) I started wondering if there was an “Out of the Box” search solution that allows users to search within specific lists. It’s a discussion that I’ve frequently seen in the TechNet forums, particularly whenever search scopes are mentioned. Whilst I wasn’t able to locate anything via the SharePoint GUI, there is indeed a way that this can be achieved, simply by using JavaScript and the Content Editor Web Part.

Solution Details

The core solution is to embed some JavaScript code within a Content Editor Web Part (CEWP) and to tweak it for your list / library. Within the source code (HTML view for SP2010) the code snippet entered provides the end user with a dropdown box, a textbox, and two buttons. These buttons are a Search button and a Clear button.

The dropdown list provided will contain a hardcoded list of all the column names that you want to make searchable. The intention is that the user selects the column to search by picking it from the dropdown box, enters his search text and then clicks the Search button.

The JavaScript will then redirect the user to the same page, with query string data appended to the URL. The Clear button sets the query string url back to blank, which in effect clears the search data and ensures that the entire list is back in view.

When search scopes are enabled in SP2010, the option to search the list is automatically included in the list of options. However, search scopes are enabled at the site collection level, meaning that once enabled, all lists within your site collection will get this option. This JavaScript alternative is particularly useful if you want to enable list-level search for specific lists only. It also has the added advantage of allowing results to be displayed in situ instead of redirecting to a search results page. However, rather than jumping straight into the code, let’s look a little at how OOB list filtering works as this is the functionality that the script plugs into.

Looking at the query string in greater detail

  • In your SharePoint site create a list that has a high number of columns. The Contacts list works perfectly for this

  • Next, input a few dummy items. Having a few rows to play with works best. In my example I’ve used two football managers from the UK Premier League as well as the national team manager

  • Now that you have some test data, apply a filter and wait for the page to reload. The demonstration screenshot below applies a filter to the Last Name column.

Script Details & how to amend

  • Step One: On the page that you want to apply the search field to, use Site Actions à Edit Page
  • Step Two: Click Add a Web Part
  • Step Three: Add an HTML Form Web Part or a Contend Editor Web Part, either will work

  • Step Four: Input the code snippet below and make the following changes
    • In the function RedirectURL add the columns you want to make searchable from left to right using the format “Column2”, “Column3” and so on
    • In the same function, locate this text window.location.href = “AllItems.aspx?” and set this to the page you want the search results rendered on. The script has this set to the default view AllItems.aspx. Please note that you MUST keep the question mark in the code.
    • In the Search field you’ll see some options that look like this: – <option
      value=”Title”>.
      These fields need to correspond to the internal name NOT the display name of the
      columns that you want to make searchable. Column internal names are explained very well here.
  • Step Five: Save the file once you’ve made your amendments and your page should reload looking something like the below, with a basic but list-specific search engine at the top of the page

Further usage

There are probably some things that you can do to take this further if so desired. Some of the tweaks I’ve made include: –

  1. Styling the buttons according to branding requirements
  2. Keeping this code in a separate HTML file and linking it within a CEWP
  3. Hiding all but the first selection field to force searching within only one column