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

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

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Normal
    • Resolution: Fixed
    • Affects Version/s: 6.0.1
    • Fix Version/s: 6.5.0, 6.0.3
    • Component/s: Components
    • Labels:
      None

      Description

      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

        Attachments

          Activity

            People

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

              Dates

              Created:
              Updated:
              Resolved: