Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

I want to disable sorting but allow filtering on DVWP.

I have struggled much for it but not able to get rid of it. If I pass 0 in sortable then it takes away both filter and sorting from context menu.

<xsl:call-template name="dvt.headerfield" ddwrt:atomic="1" xmlns:ddwrt="http://schemas.microsoft.com/WebParts/v2/DataView/runtime">
                        <xsl:with-param name="fieldname">@Title</xsl:with-param>
                        <xsl:with-param name="fieldtitle">Title</xsl:with-param>
                        <xsl:with-param name="displayname">Title</xsl:with-param>
                        <xsl:with-param name="sortable">1</xsl:with-param>
                        <xsl:with-param name="fieldtype">x:string</xsl:with-param>
                    </xsl:call-template>

Please suggest how can i achieve this? Thanks!!!

share|improve this question

1 Answer 1

Find the

<xsl:template name="dvt.headerfield">

Add a parameter

<xsl:param name="filterable">1</xsl:param>

Find the <table and remove the onmouseover attribute

under the <table tag, add

<xsl:if test="$filterable=1">
    <xsl:attribute name="onmouseover">OnMouseOverAdHocFilter(this, '{concat($displayname,$separator,$fieldname, $separator,$fieldtype, $connector, 1033, $separator, $dvt_partguid)}')</xsl:attribute>
</xsl:if>
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.