Monday, August 26, 2013

Creating a A-Z filter for a list

 

My customer wanted to have a library list, for adding books.
We had a title field for the book and some other meta data for each book.
He wanted to have a page where users could filter the list to view all books starting with A,B,C...Z
Something that will look like:
A,B,C,D,E,F,G,H,...Z
And a list grid below that will filter all books starting with the selected letter.
I found a rather easy solution for that that needed no code at all - only customization!
Basically what I did was:
1 - Add a calculated column that will hold only the first letter of the Title field.
(fomula for this: =LEFT(Title,1) )
2 - Then I added the list grid web part.
3 - To add filter support I added above a rich text web part and added the HTML for A,B,C...Z and made each letter a hyperlink to the same page with adding "?FilterBook=A".
4 - Now, all i had to do is to add a query string filter web part (comes with SharePoint) and configure it to take the filter value from "FilterBook" query string and send it to filter the list grid web part below.
Done!
No code solution that took no more than 10 minutes!
Customer happy, me happy :)

No comments:

Post a Comment