Forum Discussion
Filter list by page title
I want to make a list filter based on a page name or page title or page property.
The use case is.:
I have a list of projects "main project list", this will list all the different projects that we have. Each project has some different columns with project information, like start date, owner, description ect.
We then have a separate SP page for each project in the list "main project list" and i want the list to be placed on each page we have, but be filtered by the project name, could be the page name. I dont want to create view for each project as we have 50 to 100 projects.
Hope you guys can help,,,, thanks !!!!
2 Replies
- SvenSieverdingBronze Contributor
Hi ClausGS,
if think you have three options:
1) Ditch the project list and add all columns from that list directly to the SitePages library. Then display them using the page properties webpart on every page2) Create folders in your main project list (you can still create views that show you the data without folders). Then use the list view webpart to only display data from a given project folder on a project page
3) Install the PNP Search Webparts and use a search results wepart on your page. That webpart should have a static query that just returns one element from your projectlist.
You can use page tokens in that query (https://microsoft-search.github.io/pnp-modern-search/usage/search-results/tokens/) so that you even can reuse the entire webpart on another page. So you could use a query like "Path:<Path to your list> Title:{Page.Title}" to search for all list items in your list where the title is equal to the Title of the current site page.
But you have to set up site columns and managed properties for all custom columns on project list in order for the search webparts to work.
As far as I understand your use case, I personally would take Option (1).
Best Regards,
Sven ClausGS You can only show page properties on site page using Page Properties web part.
Unfortunately, you cannot connect List web part and Page Properties web part to filter dynamically.
You can only connect these web parts:
- Document Library
- List
- List Properties
- Embed
- File viewers (File and Media viewer)
Check this documentation if it helps: Connect web parts in SharePoint
So, you may have to create a separate list view with filter for each site page. Or use Embed web part with filtered list view URL instead of list web part. Use URL like:
https://contoso.sharepoint.com/sites/SiteName/Lists/ListName/AllItems.aspx?FilterField1=Title&FilterValue1=Item 1Please click Mark as Best Response & Like if my post helped you to solve your issue. This will help others to find the correct solution easily. It also closes the item. If the post was useful in other ways, please consider giving it Like.
For SharePoint/Power Platform blogs, visit: Ganesh Sanap Blogs