Uploaded image for project: 'ZK'
  1. ZK
  2. ZK-1227

NumberInputElement.formatNumber() should use dt.applyLocalizedPattern() instead of dt.applyPattern()

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Normal Normal
    • 6.5.0, 6.0.3
    • 6.0.1
    • Components
    • None

      NumberInputElement.java
      	protected String formatNumber(Object value, String defaultFormat) {
      		if (value == null) return "";
      
      		final DecimalFormat df = (DecimalFormat)
      			NumberFormat.getInstance(getDefaultLocale());
      		if (_rounding != BigDecimal.ROUND_HALF_EVEN)
      			df.setRoundingMode(RoundingMode.valueOf(_rounding));
      
      		String fmt = getFormat();
      		if (fmt == null) fmt = defaultFormat;
      		if (fmt != null) df.applyPattern(fmt);  //should replace if (fmt != null) df.applyLocalizedPattern();
      		return df.format(value);
      	}
      

      Test Case :

      test.zul
      <decimalbox value="1111.112" locale="pt" format="#.##0,0##" />
      

      reference : http://www.zkoss.org/forum/listComment/19974

            vincentjian vincentjian
            MontyPan MontyPan
            Votes:
            1 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: