"Connected" SharePoint List Filters

An interesting email came over the transom today with some questions about "connected" list filters:

Hi Marc,

I often visit your blog for any doubts in dataview.

I read your post on cascading dropdowns that was really helpful and presented in  nice way.

Recently i had to use a filter toolbar for a dataview,i had 3 columns to be displayed so as expected got 3 dropdown filters.

My Problem :

a)Is it possible to make the three dropdowns connected??(if my list is in such a way that col B depends on col A and col C depends on Col B)…

b)How can i enable filtering on multiple dropdowns(ie) i do not want to do a postback when i select filter of col A) instead i want to filter on Col A + Col B condition.

I would be helpful if you could give a approach or solution to the above problems.

And my response:

With code (or script — I think of script as code, too), all things are possible!  What I’ve done in the past in situations like you describe is to put dropdowns at the top of the page (not as column headers) and have them cascade.  The way I have done this is with a DVWP or DVWPs and some script for the cascading.  The dropdowns, along with a Filter button which has script behind it which posts back to the same page with the chosen options on the Query String will tie it all together.

If you want to avoid postbacks, then look into using jQuery and Web Services.  Coincidentally, I’ve been working on a jQuery Library for SharePoint Web Services. This library will make it easier to use SharePoint’s Web Services since we take care of the Ajax calls for you.  There’s also a function which can help with cascading dropdowns ($().SPServices.SPCascadeDropdowns), though it was built for use on forms.  If you’d like to see an example of something sort of analogous, take a look at this page on our Demo Site.

Hope all of this helps!

M.

Similar Posts

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.