Hello,
We have a task list where we want to customise the layout of the column headers.
I'm using an XSLT file for this, which I've specified in the list web part properties (under miscellaneous / XSL Link).
After applying the XSLT the column headers look OK, but I've lost the option to sort and filter the columns.
In a standard list, you can click on a column header, and then choose to sort it ASC or DESC or filter on specific values.
How can I keep this functionality in my XSLT ?
Contents of my XSLT:
<xsl:stylesheet xmlns:x="http://www.w3.org/2001/XMLSchema" xmlns:d="http://schemas.microsoft.com/sharepoint/dsp" version="1.0" exclude-result-prefixes="xsl msxsl ddwrt" xmlns:ddwrt="http://schemas.microsoft.com/WebParts/v2/DataView/runtime" xmlns:asp="http://schemas.microsoft.com/ASPNET/20" xmlns:__designer="http://schemas.microsoft.com/WebParts/v2/DataView/designer" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:msxsl="urn:schemas-microsoft-com:xslt" xmlns:SharePoint="Microsoft.SharePoint.WebControls" xmlns:ddwrt2="urn:frontpage:internal" xmlns:o="urn:schemas-microsoft-com:office:office"><xsl:include originalhref="/_layouts/xsl/main.xsl"/><xsl:include href="/_layouts/xsl/internal.xsl"/><xsl:template match="View[@Name='{4402B771-4518-4F07-A142-14CFF067087D}']" mode="full" ><!-- Custom Header starts here --><tr valign="top" class="ms-viewheadertr"><th class="ms-vh2" nowrap="nowrap" scope="col" colspan="1"></th><th class="ms-vh2" nowrap="nowrap" scope="col" colspan="1"></th><th class="ms-vh2" nowrap="nowrap" scope="col" colspan="2" style="text-align:center;border: 1px solid #E0E0E0; border-bottom:0;border-top: 0;padding: 0 5px">Initial Plan</th><th class="ms-vh2" nowrap="nowrap" scope="col" colspan="1"></th><th class="ms-vh2" nowrap="nowrap" scope="col" colspan="2" style="text-align:center;border: 1px solid #E0E0E0; border-bottom:0;border-top: 0;padding: 0 5px">Current Plan</th><th class="ms-vh2" nowrap="nowrap" scope="col" colspan="1"></th><th class="ms-vh2" nowrap="nowrap" scope="col" colspan="1"></th><th class="ms-vh2" nowrap="nowrap" scope="col" colspan="1"></th></tr><tr valign="top" class="ms-viewheadertr"><th class="ms-vh2" scope="col"><input type="checkbox" title="{$select_deselect_all}" onclick="ToggleAllItems(event,this,{$ViewCounter})" onfocus="EnsureSelectionHandlerOnFocus(event,this,{$ViewCounter})" /></th><th class="ms-vh2" nowrap="nowrap" scope="col" style="padding: 0 5px">Title</th> <th class="ms-vh2" nowrap="nowrap" scope="col" style="border-left: 1px solid #E0E0E0;padding: 0 5px">Start</th><th class="ms-vh2" nowrap="nowrap" scope="col" style="border-right: 1px solid #E0E0E0;padding: 0 5px">End</th><th class="ms-vh2" nowrap="nowrap" scope="col" style="padding: 0 5px">% Complete</th><th class="ms-vh2" nowrap="nowrap" scope="col" style="border-left: 1px solid #E0E0E0;padding: 0 5px">Start</th><th class="ms-vh2" nowrap="nowrap" scope="col" style="border-right: 1px solid #E0E0E0;padding: 0 5px">End</th><th class="ms-vh2" nowrap="nowrap" scope="col" style="padding: 0 5px">Completion Date</th><th class="ms-vh2" nowrap="nowrap" scope="col" style="padding: 0 5px">Health</th><th class="ms-vh2" nowrap="nowrap" scope="col" style="padding: 0 5px">Milestone</th></tr><!-- Custom Header ends here --><xsl:apply-templates select="." mode="RenderView" /> <!-- Render default view items --><xsl:apply-templates mode="footer" select="." /> <!-- Render default view footer --></xsl:template></xsl:stylesheet>
This is the result in the list:
It's my first time to customise column headers with XSLT, so all advice is very welcome :)
Thank you!