0
@@ -2619,10 +2619,13 @@ lang.augmentObject(util.DataSource, DS);
0
* <dd>String prepended before each number, like a currency designator "$"</dd>
0
* <dt>decimalPlaces {Number}</dt>
0
* <dd>Number of decimal places to round.</dd>
0
* <dt>decimalSeparator {String}</dt>
0
* <dd>Decimal separator</dd>
0
* <dt>thousandsSeparator {String}</dt>
0
* <dd>Thousands separator</dd>
0
* <dt>suffix {String} (deprecated, use format/negativeFormat)</dt>
0
* <dd>String appended after each number, like " items" (note the space)</dd>
0
@@ -2687,6 +2690,25 @@ lang.augmentObject(util.DataSource, DS);
0
+ * <p>Default values for Number.format behavior. Override properties of this
0
+ * object if you want every call to Number.format in your system to use
0
+ * specific presets.</p>
0
+ * <p>Available keys include:</p>
0
+ * <li>negativeFormat</li>
0
+ * <li>decimalSeparator</li>
0
+ * <li>decimalPlaces</li>
0
+ * <li>thousandsSeparator</li>
0
+ * <li>prefix/suffix or any other token you want to use in the format templates</li>
0
+ * @property Number.format.defaults
0
YAHOO.util.Number.format.defaults = {
0
format : '{prefix}{number}{suffix}',
0
negativeFormat : null, // defaults to -(format)
0
@@ -2695,6 +2717,19 @@ YAHOO.util.Number.format.defaults = {
0
thousandsSeparator : ''
0
+ * Apply any special formatting to the "d,ddd.dd" string. Takes either the
0
+ * cfg.format or cfg.negativeFormat template and replaces any {placeholders}
0
+ * with either the number or a value from a so-named property of the config
0
+ * @method Number.format._applyFormat
0
+ * @param tmpl {String} the cfg.format or cfg.numberFormat template string
0
+ * @param num {String} the number with separators and decimalPlaces applied
0
+ * @param data {Object} the config object, used here to populate {placeholder}s
0
+ * @return {String} the number with any decorators added
0
YAHOO.util.Number.format._applyFormat = function (tmpl, num, data) {
0
return tmpl.replace(/\{(\w+)\}/g, function (_, token) {
0
return token === 'number' ? num :