3

In my custom XSLT file, I am able to modify a choice field to swap the text for icons.

My choice looks like this; it just checks for the column header name and for the number in parenthesis, then it adds my html. The icons are set via CSS:

(1) Confirmed
(2) Waiting
(3) Unconfirmed

This works in a regular list view, but not in the GANTT view.

    <!-- Convert the Fields into a status icons    -->  
    <xsl:template match="FieldRef[@Name='Confirmation_x0020_Status']" mode="body">
        <xsl:param name="thisNode" select="."/>
        <xsl:variable name="currentValue" select="$thisNode/@Confirmation_x0020_Status" />
        <xsl:variable name="statusRating1">(1)</xsl:variable>
        <xsl:variable name="statusRating2">(2)</xsl:variable>
        <xsl:variable name="statusRating3">(3)</xsl:variable>

        <xsl:choose>
            <xsl:when test="contains($currentValue, $statusRating1)">
                <span class="statusRatingX statusRating1"></span>
            </xsl:when>
            <xsl:when test="contains($currentValue, $statusRating2)">
                <span class="statusRatingX statusRating2"></span>
            </xsl:when> 
            <xsl:when test="contains($currentValue, $statusRating3)">
                <span class="statusRatingX statusRating3"></span>
            </xsl:when> 
            <xsl:otherwise>
                <span class="statusRatingN"><xsl:value-of select="$currentValue" /></span>
            </xsl:otherwise>                    
        </xsl:choose>
    </xsl:template> 

I've gotten this far by making a copy of c:\program files\common files\microsoft shared\web server extensions\14\TEMPLATE\LAYOUTS\XSL\fldtypes.xsl and adding the above snippet to the copy and placing the copy in that same directory. It works on regular lists quite well.

So how do I make this XSLT work in GANTT view?

[edit]

Has anyone ever even tried to use icons in GANTT view? Does anyone have an idea why this doesn't work?

2
  • 1
    I suppose this is a lousy question? I've posted complete code and examples and explained thouroughly my issue. I should at least get votes for my effort, no? 16 views and no votes. I've discovered that getting upvotes on questions in SSE is like pulling teeth.
    – bgmCoder
    Jul 26, 2013 at 13:50
  • Thank you to whoever listened to my rant and upvoted my poor question!
    – bgmCoder
    Aug 1, 2013 at 13:25

1 Answer 1

1

Just being trying to find an extension point for the list view web part when it displaying a Gantt Chart view.

If you add a list view to a page of your list and then switch to the Gantt Chart view you get an option to override the XSLLink with custom XSLT. However, if you apply the web part properties then those options disappear.

So, the Gantt chart in SharePoint 2010 seems to do all the rendering in the web control. In SharePoint 2013 there is a SP.Gantt.js which does the rendering.

So the only solution that I can think of would be to override the Microsoft.SharePoint.WebControl.Gantt class (its public and not sealed) (http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.webcontrols.gantt_members(v=office.14).aspx) and then create your own custom list definition with a custom list schema and list view.

Sounds a little scary.

1
  • Interesting. Interesting but definitely scary. I suppose I could do it with jQuery by way of a workaround.
    – bgmCoder
    Aug 3, 2013 at 14:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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