Sometimes when hovering over a fieldvalue in the refinementpanel the tooltip displays only ‘Refine By:’ without displaying any value.
While another displays an actual value:
Actual term in a tree
Why?
When the fieldvalue is less than 19 characters the tooltip stays empty. Well empty.. it displays ‘Refine By:’. Every fieldvalue with more than 19 characters is displayed in the tooltip. A ‘parent’ term or a whole path.
How to solve?
This behavior can be solved by adjusting the xslt.
Original xslt:
<a href="{$SecureUrl}" title="{$RefineByHeading}: {$UrlTooltip}"> <xsl:value-of select="Value"/> </a>
Adjusted xslt:
<xsl:variable name="UrlTooltipAdjusted"> <xsl:call-template name="format-tooltip"> <xsl:with-param name="tooltip" select="$UrlTooltip" /> <xsl:with-param name="string" select="Value" /> </xsl:call-template> </xsl:variable> <a href="{$SecureUrl}" title="{$RefineByHeading}: $UrlTooltipAdjusted}"> <xsl:value-of select="Value"/> </a> <xsl:template name="format-tooltip"> <xsl:param name="tooltip" /> <xsl:param name="string" /> <xsl:choose> <xsl:when test="$tooltip != ''"> <xsl:value-of select="$tooltip" /> </xsl:when> <xsl:otherwise> <xsl:value-of select="$string" /> </xsl:otherwise> </xsl:choose> </xsl:template>
The ‘format-tooltip’ template checks if the tooltip is empty and replaces the tooltip value with the actual fieldvalue if so.
By doing this the tooltip will never be empty and will always show the value of the fieldvalue.
Summary
Besides the fieldvalues also the tooltip values suffer from a character limitation. The values of the refinement panel have a 19 character display limit, the tooltip doesn’t display the value when the fieldvalue is less than 19 characters.
This and the previous post solve these issues by making minor adjustments to the OOTB xslt.