Ask a questionAsk a question
 

AnswerHow to implement filter lists in SPD?

  • Monday, September 28, 2009 7:33 AMMcGeeky Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Hi. I want to implement a filter form for a List View Web Part, filtering on 3 different columns. In this case "Supplier", "Type" and "Part Number".

    Each filter is to use a drop down list, populated with the column values from the List View Web Part.

    Is there a way to implement this functionality using no code in SharePoint Designer? It is not apparent how to do this.

    Thanks.

    McGeeky

Answers

  • Tuesday, September 29, 2009 4:25 AMsympmarc Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     Answer
    You have a number of options for this, but I would use Data View Web Parts (DVWPs) to create the dropdowns based on the contents of the list as well as to display the filtered results.  However, why are the filters which are available in the column headers not adequate?

    M.
    Marc D Anderson - Sympraxis Consulting LLC - Marc D Anderson's Blog - @sympmarc
    • Marked As Answer byMcGeeky Tuesday, September 29, 2009 11:06 AM
    •  
  • Tuesday, September 29, 2009 11:38 AMsympmarc Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     Answer
    McGeeky:

    As for the linking, I would forego Web Part Connections, as I've seen too many people have issues with them.  Simply add a "Go" (or "Submit" or whatever) button which gathers up the filter values and passes them back to the same page on the Query String.  Then have your "main" DVWP filter based on those values.  You may need to write a little XSL to make the filtering work correctly.  Once you dive in and see how much you can do with DVWPs, you may want to, anyway!  ;=)

    I understand on the usability question for the column headers.  Of course, you're trading training for coding.  That and the fact that everywhere else there is a list displayed in SharePoint, the filtering is available on the headers (if it is enabled in that instance).  This means that the users won't know about this great capability unless they stumble on it.  It might be worth explaining this to your customer a little.

    M.
    Marc D Anderson - Sympraxis Consulting LLC - Marc D Anderson's Blog - @sympmarc
    • Marked As Answer byMcGeeky Tuesday, September 29, 2009 11:45 AM
    •  

All Replies

  • Tuesday, September 29, 2009 4:25 AMsympmarc Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     Answer
    You have a number of options for this, but I would use Data View Web Parts (DVWPs) to create the dropdowns based on the contents of the list as well as to display the filtered results.  However, why are the filters which are available in the column headers not adequate?

    M.
    Marc D Anderson - Sympraxis Consulting LLC - Marc D Anderson's Blog - @sympmarc
    • Marked As Answer byMcGeeky Tuesday, September 29, 2009 11:06 AM
    •  
  • Tuesday, September 29, 2009 11:06 AMMcGeeky Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Marc. Thanks for your reply. Over the past day I have been investigating the various techniques for achieving filter lists; one of the options I explored is your suggestion and I think this will be the option I will choose as it is the most "elegant".

    I am planning to have one DVWP per drop down list, then link them to another DVWP that displays the actual filtered results. My research has shown that some modification is required of the resultant XSLT to make that work (such as for removing duplicates in the drop down lists). Can the linking be done with out XSLT modification?

    >> However, why are the filters which are available in the column headers not adequate?

    Technically, column header filter lists work fine, but our customer wanted to make the filters more obvious to the end users through a dedicated filter form as it is not obvious to the casual observer how to filter - a small but important usability issue for us. Also, we are looking at extending the form to add the facility for a partial column match using the "contains" clause.

    Regards,

    McGeeky
  • Tuesday, September 29, 2009 11:38 AMsympmarc Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     Answer
    McGeeky:

    As for the linking, I would forego Web Part Connections, as I've seen too many people have issues with them.  Simply add a "Go" (or "Submit" or whatever) button which gathers up the filter values and passes them back to the same page on the Query String.  Then have your "main" DVWP filter based on those values.  You may need to write a little XSL to make the filtering work correctly.  Once you dive in and see how much you can do with DVWPs, you may want to, anyway!  ;=)

    I understand on the usability question for the column headers.  Of course, you're trading training for coding.  That and the fact that everywhere else there is a list displayed in SharePoint, the filtering is available on the headers (if it is enabled in that instance).  This means that the users won't know about this great capability unless they stumble on it.  It might be worth explaining this to your customer a little.

    M.
    Marc D Anderson - Sympraxis Consulting LLC - Marc D Anderson's Blog - @sympmarc
    • Marked As Answer byMcGeeky Tuesday, September 29, 2009 11:45 AM
    •  
  • Tuesday, September 29, 2009 11:51 AMMcGeeky Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Excellent advice, thanks Marc. I agree with your assertion around the tradeoff between training and coding. Normally I would be advising the simpler route using out of the box functionality; this situation however does lend itself to a "coded/configured" approach, well, in my opinion.

    SharePoint (in this case SharePoint Online) is being used as a portal for our customer's customers. We want to hide as much of the "underbelly" of SharePoint Online as we can from the portal users. For administrators/operators and internal users at our customer, they are quite happy to use the out of the box list functionality. The look and feel they want to project to their customers is quite different though.

    McGeeky
  • Tuesday, September 29, 2009 12:30 PMsympmarc Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Got it.  For a public-facing site, your approach is undoubtedly the right one.  Take a look at this site that I worked on for some of the great things you can accomplish with DVWPs: http://chesterton.com.  It's got some warts, but the DVWP stuff is solid.  Even the Quick Launch is redone with DVWPs based on the contents of lists.

    M.
    Marc D Anderson - Sympraxis Consulting LLC - Marc D Anderson's Blog - @sympmarc
  • Tuesday, September 29, 2009 2:29 PMMcGeeky Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Hey that's excellent, thanks Marc! It's amazing what you have achieved with the DVWP. As you can tell, I am fairly new to the DVWP. I have been forced to pick it up due to the locked down environment of SharePoint Online. However, I am very pleasantly surprised by the extent to which it can be customised without a line of C# code in sight!