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:
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:
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.
And because the List Item Filter accepts incoming filters, you can also use another filter to filter the tag cloud:
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.
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:
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:
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.