Skip to main content

Weblog Ton Stegeman [MVP]

Go Search
Home
  

ODC 2008
If you have a question or suggestion, please contact me through Windows Live Messenger.
My status: .

If I am not online, please send me an e-mail.
Weblog Ton Stegeman [MVP] > Posts > Introducing the List Item Filter web part
Introducing the List Item Filter web part

After having introduced the Content By Type web part, I got questions on how to filter the content of this web part. After writing a number of articles on filter web parts, I decided it was time to add a custom filter web part to the content by type package. The first filter web part in that package is the List Item Filter web part. A bit like the out of the SharePoint List Filter, but without the popup for users to select filter values. The List Item Filter has 4 options. It can render as:

If you think ‘that is nice, but filter web parts are only available if I have the Enterprise license.’ at this point, keep on reading! This filter web part will also work in MOSS Standard and even in WSS!

Sending and receiving filters

Apart from being a filter provider, the List Item Filter is also a filter consumer. This means you can send a filter value from any SharePoint filter web part to the List Item Filter, and it will filter the items displayed. This means you can ‘chain’ these filters like in the screenshot below:

image

The ‘region’ selector on the top filters the country selector. The Country filter web part filters the list of cities. And after selecting one or more cities, the selected cities are passed to the list of contacts. This screenshot shows 4 web parts; 3 instances of the List Item Filter web part and 1 Content By Type web part. The page in edit mode looks like this:

image

Because the List Item Filter is built using the out of the box filtering technique, it will work with the other SharePoint filter web parts. If you want to get the region from the user’s profile and use that to filter the country dropdown, you can use the out of the box Current User Filter web part to get the region from the profile and send that as a filter to the List Item Filter web part.

In these screenshots you have seen 3 ways of rendering the options. There is a 4th way, which is the tagcloud, is shown in the screenshot below.

image

And because the List Item Filter accepts incoming filters, you can also use another filter to filter the tag cloud:

image

Field types

The values of the items that are displayed in the list or tag cloud, are formatted according to the formatting options of the list field. If you want to filter on a currency field, the items are displayed according to the formatting options of your currency field. You can even use the outcome of a calculated field as a filter value. And if you have multivalued fields in your list, the items are added as single items to the List Item Filter web part, as you can see in the screenshot below.

image

In my Contacts list I added a multivalued Person field. I configured the List Items Filter web part to use this field, and I checked the ‘Just display distinct values’ checkbox:
image

This resulted in a single list of all person that have a reference to a contact. Or you can use the tag cloud option for this, to give you an impression who has most references to contacts:

image

New version of the Content By Type web part

The package contains a new version of the Content By Type webpart, version 1.21. This is exactly the same version as v1.2, with a couple of bugfixes. If you are currently using v1.2, you can upgrade using the setup in the package. You will then also get the List Item Filter web part.

Where do I get it?

The filter web part is available on the e-office CodePlex site. The home page has the link to the latest release. Please let me know if you have any suggestions to improve the web part. I am also interested in your ideas for other filter web parts that you would like to see.

Comments

Looking good Ton

Hey Ton,

It looks good, I'll have to give it a whirl!
Cheers

Tobias,
http://www.zimmergren.net
at 11/27/2008 3:42 AM

List Item Filter Fails On WSS Site

Ton,

Installation Goes Fine.  Setting up the Filter appears Fine.  The list to be filtered is found and the drop downs are populated with valid field names.  After completing web part setup, the drop down only display the name of the web part -- not the configured field values of the configured list.  Reconfiguring the web part to display as a checkbox list fails with "startIndex cannot be larger than length of string".    Any ideas??

BobM
at 11/30/2008 3:59 PM

Error

Can't understand how to enter url to list, always get no list found at url
at 12/2/2008 12:19 PM

suggestions

Thanks a lot for your List Item Filter web part. Here are some suggestions ...
- button for searching of a list doesn't seam to do display expected window, but finally I found correct format (/<sitename>/<subsitename>/Lists/<listname)
- when I remove a connection, the source DropDownList has no items (maybe it can be error of SharePoint, when connection proxies are not removed as it should be)
- filtering on ListViewWP or DFWP of the same list doesn't work for me. (example: In DropDownList are all records of a list and in connected webpart should be displayed some detail of the selected record). No record is displayed in this case, even then I try to make connection via "Id" field or any custom key field such as "Code".
- customizable GUI: DDL, Radion Buttons, CheckBox list, Tag Cloud is perfect, ... only custom XSLT is missing :)

It would be great if you'll improve this nice peace of code.

Thank you, Ondrej
at 12/5/2008 5:37 AM

Error: Value does not fall within the expected range.

I'm getting this error when I connect a Current User Filter Web Part to the List Item View Web Part.

Error occurs if I'm passing one or more values from the user profile property.

Error doesn't occur if the property value is blank.

at 12/10/2008 2:07 PM

Filter Actions

Will this web part work with the Filter Actions web part for Applying and Saving Defulats?
at 1/8/2009 1:20 PM

New version available

@All having troubles configuring the web part or getting error messages: there is a new version available here:
http://www.tonstegeman.com/Blog/Lists/Posts/Post.aspx?ID=92

@Ondrej: the latest release also contains the XSLT GUI. Thanks for the suggestion!
Ton Stegeman at 1/11/2009 4:09 AM

Nice suggestion

Thanks for the Filter Actions suggestion. I will look into that for a next release. In this version it will not work.

Ton
Ton Stegeman at 1/11/2009 4:10 AM

Applying default filter

Hi, Ton,
A very useful web part. One question - is it possible to set a default filter value in the current release if the List Item Filter webpart? At the moment, visitors landing on the page see every row in the list displayed. I'd like to limit the initial view of the list to one of the filter values from the filter list. Is this possible?
Alan McKenzie
at 2/8/2010 7:42 AM

Default value

Hi Alan,
You can use any other filter provider web part (like the text filter web part) to set the default value. There is a special sort of connection on the list item filter web part to do that.
Ton Stegeman at 3/27/2010 4:32 AM

Add Comment

Items on this list require content approval. Your submission will not appear in public views until approved by someone with proper rights. More information on content approval.

Title


Body *


Your city *


Type the name of the city you live in (making it easier to handle spam...)

CurrentDate *

Select the current date (see if this gives me fewer spam...)
Attachments

 Links

  SharePoint Object on CodePlex
  Screencast introducing SharePoint Objects
  Content by Type and Filter Web Parts on CodePlex
  Archive
  Archive (Calendar)

 My Latest Blog Posts

Scripting SharePoint 2007 setup: choices and conceptsUse SHIFT+ENTER to open the menu (new window).
Adventures in Visual Studio 2010: Migrate the Content By Type web part to SharePoint 2010Use SHIFT+ENTER to open the menu (new window).
Register SharePoint themes by using a featureUse SHIFT+ENTER to open the menu (new window).
SharePoint 2010 development on Windows 2008 Server R2 – Getting StartedUse SHIFT+ENTER to open the menu (new window).
New release SharePoint Objects: features and groupsUse SHIFT+ENTER to open the menu (new window).
Constructing the url to the SharePoint Edit Permissions pageUse SHIFT+ENTER to open the menu (new window).
Screencast: introduction to SharePoint ObjectsUse SHIFT+ENTER to open the menu (new window).
SharePoint 2007 and Reporting ServicesUse SHIFT+ENTER to open the menu (new window).
SharePoint Objects – Insight in usage of your SharePoint artifactsUse SHIFT+ENTER to open the menu (new window).
SharePoint 2007 Custom list schema and the Content Query Web PartUse SHIFT+ENTER to open the menu (new window).
SharePoint 2010 Silverlight Client Object Model – ExecuteQuery vs ExecuteQueryAsyncUse SHIFT+ENTER to open the menu (new window).
SharePoint 2010, the Client Object Models and Bing MapsUse SHIFT+ENTER to open the menu (new window).
Having fun with SharePoint 2010, Silverlight 3 and Bing MapsUse SHIFT+ENTER to open the menu (new window).
Connecting TFS 2010 projects to SharePoint sitesUse SHIFT+ENTER to open the menu (new window).
Adding a database to the SharePoint database Server using SPDatabaseUse SHIFT+ENTER to open the menu (new window).