Dave recently submitted the following question on MSDN forums:
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?
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:
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:
<td class="ms-toolbar" nowrap="nowrap">
<xsl:with-param name="Rows" select="$Rows" />
...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.