You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by gc...@apache.org on 2011/12/02 19:15:09 UTC
svn commit: r1209619 -
/myfaces/trinidad/trunk/trinidad-impl/src/main/javascript/META-INF/adf/jsLibs/NumberFormat.js
Author: gcrawford
Date: Fri Dec 2 18:15:07 2011
New Revision: 1209619
URL: http://svn.apache.org/viewvc?rev=1209619&view=rev
Log:
TRINIDAD-2139 Client NumberConverter with type=percent ignores maxfractiondigits when formatting
Thanks to Yee-Wah
Modified:
myfaces/trinidad/trunk/trinidad-impl/src/main/javascript/META-INF/adf/jsLibs/NumberFormat.js
Modified: myfaces/trinidad/trunk/trinidad-impl/src/main/javascript/META-INF/adf/jsLibs/NumberFormat.js
URL: http://svn.apache.org/viewvc/myfaces/trinidad/trunk/trinidad-impl/src/main/javascript/META-INF/adf/jsLibs/NumberFormat.js?rev=1209619&r1=1209618&r2=1209619&view=diff
==============================================================================
--- myfaces/trinidad/trunk/trinidad-impl/src/main/javascript/META-INF/adf/jsLibs/NumberFormat.js (original)
+++ myfaces/trinidad/trunk/trinidad-impl/src/main/javascript/META-INF/adf/jsLibs/NumberFormat.js Fri Dec 2 18:15:07 2011
@@ -147,6 +147,7 @@ TrNumberFormat.prototype.setMaximumFract
{
this._minFractionDigits = this._maxFractionDigits;
}
+ this._isMaxFractionDigitsSet = true;
}
}
@@ -394,7 +395,13 @@ TrNumberFormat.prototype.currencyToStrin
TrNumberFormat.prototype.percentageToString = function(number)
{
number = number * 100;
- number = this.getRounded(number);
+ // TRINIDAD-2139: getRounded calls Math.round() on number. Since number is
+ // multiplied by 100 before this call and later divided, the result will
+ // have at most 2 fractional digits, regardless of the value of maxFractionDigits.
+ // Hence, if maxFractionDigits is set, don't call this method and let
+ // numberToString format the string appropriately.
+ if (this._isMaxFractionDigitsSet == null)
+ number = this.getRounded(number);
if (isNaN(number))
{
throw new TrParseException("not able to parse number");