I have a DVWP that I wish to model after a physical binder-based file system. I have a column named 'Title' and a column named 'Tab'. I have the view filtered by a column named 'Facility' and it is all grouped by 'Tab'. I would like the 'Tab' group header to show even when the group is empty. How is the best way to go about this?
The grouping is based on actual values returned (as you mentionned in your comment). So what you need is all the values of 'Tab' no matter what items are returned.
What I would do is make a custom list for your 'Tab' values and then create a lookup column. After that, make a linked source between my lookup list and the actual data. That would show all of the 'Tab' values and then show all items of the list filtered by that value, if any.
Here is what I did to get the result I had requested:
I had established a DVWP that I grouped by a column named 'Tab'. I had the count of the node-set as part of eacah group header. The contents of this column read like this
- Tab: 01 TAG's Policy Memorandum (1)
- Tab: 02 EPCRA Tier II Letter (4)
- Tab: 03 ECO Appointment Memoranda (3)
The rows then would be sorted by 'Title' or any other column as needed under these headers.
This worked well as long as there was an item in each node-set. As stated in the question, if the node-set was empty, no value is returned for the column and there is no group header. So I simply added row with a dummy value for each value of 'Tab'. I gave it a fairly obnoxious name that was not likely to ever be used as true value. I had the 'Title' valued as 'Placeholder to hold tab open' for each value of 'Tab'. I then modified the XSL Template SharePoint calls 'dvt_1.rowview' and nested the contents of this template in the follow if statement:
<xsl:if test="not(normalize-space(@Title) = 'Placeholder to hold tab open')">
This way only those rows that do not hold the sentinel value are rendered. This put the count off for the group headers as even though the row with the sentinel value was not rendered into HTML it was still part of the node-set. I fixed this at the point of the render for the group header.
In the XSL Template SharePoint called dvt_1.groupheader0 I modified the comparisons from
count(nodeset)-1. This both fixed the counts in the header as well as allowed me to format "empty" group headers so they were more subdued than those groups with content important to the end user.
Perhaps not the most elegant solution, but it looks nice on the page.