Format a number in xp:link

Format a number in xp:link

I just came across a problem where i wanted to display formatted numbers which are links (In this case in a repeat control).
How can i format the number here? The usual way is like this: 

<xp:text escape="true" value="#{figureItem.amountRounded}">
	<xp:this.converter>
		<xp:convertNumber pattern="#,##0"></xp:convertNumber>
	</xp:this.converter>
</xp:text>

So it gives me an output like “134’222″..
When i want to do the same in clickable links (xpages xp:link tag), i tried it like this:

<xp:link escape="true" value="javascript:refreshDetails()"
	text="#{figureItem.amountRounded}">
		<xp:this.converter>
			<xp:convertNumber pattern="#,##0"></xp:convertNumber>
		</xp:this.converter>
</xp:link>

Altough Domino Designer lets me compile this, it doesn’t format the number values..

So what to do? I already posted recently a NumberConverter Function Object here: http://www.fdehedin.ch/91/convert-number-to-string-to-number
If you place that in an SSJS Library, you can format the numbers in a link like this:

<xp:link escape="true" value="javascript:refreshDetails()"
	text="#{javascript:NumberConverter.numberToString( figureItem.amountRounded, '#,##0')}">
</xp:link>

Leave a Reply

comment-avatar

*