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 am aware of the various methods to colorcode columns (jquery, formula) I choose here to use designer on allitems.aspx on a list (im lazy and its easy).

I have given various columns background colors based on their values using xsl styles e.g. date > xx etc...works fine.

However... now i notice i have 1 calculated column in there (which display different numbers based on two others columns) where the xsl does not show the background color.

<xsl:attribute name="style">
    <xsl:if test="$thisNode/@Level. &lt; 4" ddwrt:cf_explicit="1" xmlns:ddwrt="http://schemas.microsoft.com/WebParts/v2/DataView/runtime">background-color: #33CC33;</xsl:if>

    <xsl:if test="$thisNode/@Level. &gt; 4 and $thisNode/@Level. &lt; 9" ddwrt:cf_explicit="1" xmlns:ddwrt="http://schemas.microsoft.com/WebParts/v2/DataView/runtime">background-color: #FFFF00;</xsl:if>

    <xsl:if test="$thisNode/@Level. &gt; 9 and $thisNode/@Level. &lt; 17" ddwrt:cf_explicit="1" xmlns:ddwrt="http://schemas.microsoft.com/WebParts/v2/DataView/runtime">background-color: #FF9900;</xsl:if>

    <xsl:if test="$thisNode/@Level. &gt; 16" ddwrt:cf_explicit="1" xmlns:ddwrt="http://schemas.microsoft.com/WebParts/v2/DataView/runtime">background-color: #FF0000; color: #FFFFFF;</xsl:if>

</xsl:attribute>

When I try to Google for this I find all the hits on "using a calculated column to display colorcoded fields" but I cant find "using designer XSL to colorcode background on a calculated column".

Should I add something extra in there, sort of delayed processing or should I add a jquery clause specifically for this column?

share|improve this question
    
Isn't it ironic that you use this method because it's easy, but can't get it to work? –  Christophe May 10 '13 at 17:08
    
@Christophe : got it to work, answered it. Forgot it was txt. –  edelwater May 11 '13 at 1:14
add comment

1 Answer

The field is text so... need to convert it back to numeric e.g.:

xsl:if test="number($thisNode/@Level) &lt; '12'" 

etc... works great.

share|improve this answer
add comment

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.