In a previous post I already explained how to create a default filter using our List Filter Web Part. In this post I want to explain how to initially filter a view by the current user. As you might already know it’s quite simple to create a filtered view that displays, for example, all items assigned to the user currently logged in. Here you can use the dynamic filter value [me].
This is a very nice feature, but if you want to allow your users to remove this filter, you have to provide a second view which displays all items.
With our SharePoint List Filter Web Part it’s possible to create a default filter (filter on initial load) and allow your users to change this filter or display all possible items.
Create a default filter using the SharePoint List Filter Web Part
In my case I have a simple task list with 5 tasks assigned to 3 different users.
On this view page I now add the SharePoint List Filter Web Part.
Click on “Open the tool pane” to configure the filter web part.
I configured the filter web part to only use the “Task Name” for the keyword search. This allows me to enter a keyword in the search box and the filter web part displays all tasks where the keyword is part of the title.
I selected the fields “Assigned To” and “Task Status” for the filter details. I also allowed multiple selection. This gives me 2 multi select drop downs in the filter details.
Display filter menu
It’s very important that “Display filter menu” is activated because this is the menu where we can save private and public filters.
Click on OK or Apply to save the settings and set up the filter web part.
Now I filtered the view by my user and saved it as a public filter using the “predefined filter menu”.
The name of my filter is “My tasks”. This adds a new entry to the predefined filter menu for all users, because I saved it as “public”.
I then clicked on “Manage filters” in the predefined filters menu to modify the previously created filter.
Here is the “My tasks” filter.
“Edit Item” opens the edit form of the filter, where I can change the filter and configure it as a “default filter”.
To always use the user currently logged in instead of my user account, I replace my user id with <UserID />. Here you can also use [Me].
If I open the task list now, I will only see my tasks and the filter web part has also selected my user for “Assigned To”.
If I want to display all tasks, I can reset this filter.
I can also change the “Assigned To” filter to display all possible values (all users from the site).
If I do this, I can directly choose from all possible users without resetting the filter.
If you have problems configuring the filter web part or a default filter, send an e-mail to firstname.lastname@example.org.
Try it out for free
Are you intrigued? Try the SharePoint Filter Web Part out for free! We offer a free 30 day trial version. If you have any questions or feedback regarding our products, please don’t hesitate to send us an e-mail!