No announcement yet.
  • Filter
  • Time
Clear All
new posts

    Issues formatting localeFloat


    We recently switched out data source "float" fields to "localeFloat"
    When showing that field as a StaticTextItem we discovered that formatting does not hold - e.g. setting format to "0.00#" does not prevent from dropping second 0 after dot and setting it to "0.0##' does not make it round to 3 decimal points, sometimes it will round to 2 and sometimes to 1 even when it's not a trailing 0 issue.
    This all works perfectly fine when field type is simply "float".
    We also noticed that TextItem.setValueFormatter is not called for localeFloat field types but that's ok if we can make setFormat work well.

    We're on SmartGWT 6.1p, SmartClient v11.1p_2018-03-17

    Thank you!

    We tried reproducing this but neither issue could be reproduced. Please try a fully patched build, and make sure to do so in the future before posting issues.


      You're right. Sorry. But now I've upgraded to v11.1p_2019-10-30 and still seeing this.

      Some more details:

      We have DynamicForm that is data bound through ValuesManager. Field is defined in data source:
      <field name="baseAmount" type="localeFloat" format="#0.00" escapeHTML="true"> In DynamicForm it's mapped to a StaticTextItem. We also tried staticTextItem.setFormat("#0.00") and also tried staticTextItem.setDecimalPrecision(2)

      In all cases second trailing zero is dropped...


        Could you please show complete code that reproduces this issue? We've already tried once with the latest version, and did not reproduce either claimed issue, so we need to see a standalone, ready-to-run test case.


          I'm sorry - you're right. While building standalone case we discovered that in the bowls of our code in TextItem creation we're actually doing this:

          NumberFormat format = NumberFormat.getFormat("0.0");
          format.overrideFractionDigits(minDigits, maxDigits);

          where minDigits and maxDigits is read from configuration and even when minDigits equals 2 it does not apparently change the pattern and still format.getPattern() returns "0.0" so formatting happens accordingly. Seems to me this is a bug in GWT.

          Sorry for wasting your time....