SharePoint DVWP Filter Toolbar: Remove Filterability on Columns
Author: Jim Bob Howard
Dave recently submitted the following question on MSDN forums:
Hi all,
Using: WSS 3.0, SharePoint Designer 2007
I have created a DVWP to display data from a custom list on a site and this is working great for the most part. However, I have a query regarding the DVWP filtering:
I have turned on the toolbar to display the filter options and when I click the filter icon, I can see all of my columns listed – so far so good. The issue I have is that I want to cut this down to only show 2 of the columns available (I currently have 10 columns).
Anyone know how to customise this?
Cheers. Dave.
The great thing about the DVWP is that it’s just XSL. XSL is what tells the browser what to draw in HTML, so you can go in and remove any of the columns you don’t want the user to filter by.
At the top of your stylesheet, find:
<xsl:param name="dvt_adhocmode" />
…and change it to:
<xsl:param name="dvt_adhocmode">filter</xsl:param>
When you click in the Code pane again, you will see all of your filters.

Now you can click on one of the selects to see where they’re drawn. When you do, you’ll see they’re all drawn with the same piece of XSL inside the dvt.filterfield template. If you search for where those are called, you can strip out the ones you don’t want.
For example, if you don’t want the user to have the ability to filter on "Manager," find:
<th nowrap="nowrap"> <table> <tr> <td class="ms-toolbar" nowrap="nowrap"> <xsl:call-template name="dvt.filterfield"> <xsl:with-param name="fieldname">Manager</xsl:with-param> <xsl:with-param name="fieldtitle">Manager</xsl:with-param> <xsl:with-param name="Rows" select="$Rows" /> <xsl:with-param name="fieldtype">text</xsl:with-param> </xsl:call-template> </td> </tr> </table> </th>
…and replace it with:
<th nowrap="nowrap" valign="top">Manager</th>
Or delete the entire TH, depending on how you want it to look. The last TD in that TR has a width of 99%, so it will fill in the gap if you delete one (or more).

Note: Be sure to reset the dvt_adhocmode before saving if you don’t want the filter toolbar to display by default. But, that’s an additional feature to know: if you leave that set to filter, you can have the filter toolbar display by default.
Author: Jim Bob Howard
Jim Bob Howard is a web designer / webmaster in the healthcare industry. He has been working with SharePoint since March 2009 and enjoys sharing what he has learned. He is a moderator and frequent contributor to Stump the Panel, and answers SharePoint questions on Twitter (@jbhoward) and via email ([email protected]).
Thanks again for this.
One other thing I needed to do after I had cut down my filter fields was to remove a bunch of duplicate entries in my filter fields. I found the answer over at Pete Stilgoe’s site (http://www.petestilgoe.com/2010/08/dvwp-how-to-remove-duplicate-entries-in-filter-dropdown-list/).
Now my DVWP is running exactly as required :)
Hi Jim,
Well… ‘I didn’t know you could do that!’ That’s pretty awesome.
I will have to try when I et more time but would you know if using combined datasources (which are only a row based filter – not a joint as Marc’s usualy points out) would ‘break’ the sorting or filtering toolbar?
Greg
Greg,
It shouldn’t break the filter since it’s handled in the XSLT, rather than at the server. Especially if you’re doing a Merge, rather than a Join. I haven’t tested it though.
When you have the time, give it a try and let us know how it works out. ;)
Blessings,
Jim Bob
Another idea…
Since we could do pretty much anything in XSL in ddwrt function, why not tweak the XSL of a DVWP to sort by dates [knowing SP handles this pretty badly OOTB ref. http://www.endusersharepoint.com/2010/11/16/qotd-sharepoint-start-time-field/
Probably a reusable template for http://spxslt.codeplex.com/..
Greg
I changed
to
filter
and I get an error mesage: “XSLT transform failed: 0×80004005:…………” any suggestions
You code won’t come through here. Post your question to STP and we can walk through it:
http://endusersharepoint.com/STP/viewforum.php?f=16
Blessings,
Jim Bob
Dear
I had set unique permission for one sub site in my sharepoint server 2007.
I gave different permissions for users.
Unfortunately I inherited permissions from parent site.
All unique permissions are lost.
I want to see the previous unique permission and restore to it.
I already enable Editing users and permissions in Configure Audit Settings.
I can see the report in View Auditing Reports – Security settings.
But this excel file contain only code like
1073741924170849E1DB.
How can i view the previous permission of each user ?
Yikes. ams, I’m not sure you can get previous permissions unless you do a restore. Anyone else have more help? I’ve not run into this situation, but I’m sure someone has?
Dear,
I have window application software.
can i work this software in sharepoint?
i.e. open and work this software in sharepoint page?