Announcement

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

    Issue with DoubleItem and decimalPrecision

    Hi guys,

    I'm facing a problem with DoubleItem and using setDecimalPrecision. In the latest version of SmartGWT 12.0 20190711 there are two issues:
    1. Setting type = float, decimalPrecision is not respected and all decimals are shown
    2. Setting type = localeFloat, decimalPrecision is not respected and it is only showing 3 decimals. Also, when I select the field, it does not show the original precision.

    Consider the following app:
    Code:
    public class App implements EntryPoint {
    
        public void onModuleLoad() {
            DoubleItem doubleItem = new DoubleItem("float");
            doubleItem.setType("float");
            doubleItem.setValue(8.123456789);
            doubleItem.setDecimalPrecision(5);
    
            DoubleItem doubleItem2 = new DoubleItem("localeFloat");
            doubleItem2.setType("localeFloat");
            doubleItem2.setValue(8.123456789);
            doubleItem2.setDecimalPrecision(5);
    
            DynamicForm form = new DynamicForm();
            form.setNumCols(3);
            form.setWidth100();
            form.setItems(doubleItem, doubleItem2);
    
            Layout panel = new VLayout();
            panel.setPadding(50);
            panel.setWidth100();
            panel.setHeight100();
            panel.setMembers(form);
            panel.draw();
        }
    }

    Using SmartGwt-LGPL-12.0-20181113:
    Click image for larger version

Name:	Screenshot 2019-07-12 at 07.37.43.png
Views:	144
Size:	1.6 KB
ID:	258646
    Ok, decimal precision is respected. When I select the first field of type float:
    Click image for larger version

Name:	Screenshot 2019-07-12 at 07.37.48.png
Views:	105
Size:	4.8 KB
ID:	258647
    Ok, original precision of value is shown. But this does not work for the field of type localeFloat:
    Click image for larger version

Name:	Screenshot 2019-07-12 at 07.37.53.png
Views:	109
Size:	3.8 KB
ID:	258648
    Field is selected, but original precision is not shown.
    Switching to SmartGwt-LGPL-12.0-20190711, I get the following:
    Click image for larger version

Name:	Screenshot 2019-07-12 at 07.38.37.png
Views:	106
Size:	1.9 KB
ID:	258649
    Decimal precision is not respected in any of the two fields. The field of type float is just showing all decimals and the field of type locale float is showing 3 decimals.
    Select the localeFloat field and it shows me the number of decimals, that I specified in setDecimalPrecision - and not the original decimal precision of the value as expected.
    Click image for larger version

Name:	Screenshot 2019-07-12 at 07.51.33.png
Views:	101
Size:	4.8 KB
ID:	258650
    Are there any workarounds for this?
    Hope that you can help with this issue.

    Best Regards
    Rasmus

    #2
    Please retest with a build dated July 16 or later - you should find that all float types now edit the full decimal value and display only the specified decimalPrecision.

    Comment


      #3
      Hi,

      I have just tested with 2019-07-16 build, and it has been fixed for the "float" item, but the behaviour is very strange for the "localeFloat".

      Using the same testcase as in the first post.
      Initially it shows the 5 decimals as requested, but when I select the item, it only shows 2 decimals. When I change focus back to another item, it keeps showing only the two decimals.

      Initial load of app, shows 5 decimals as expected:
      Click image for larger version

Name:	Screenshot 2019-07-16 at 16.32.29.png
Views:	107
Size:	2.4 KB
ID:	258700
      This is when I select the field (should show all 9):
      Click image for larger version  Name:	Screenshot 2019-07-16 at 16.26.18.png Views:	1 Size:	5.3 KB ID:	258698
      And this is after I change focus away from the field:
      Click image for larger version  Name:	Screenshot 2019-07-16 at 16.28.12.png Views:	1 Size:	2.4 KB ID:	258699
      So, now it does not show the 5 decimals anymore.

      Best Regards
      Rasmus
      Attached Files
      Last edited by rn; 16 Jul 2019, 06:33.

      Comment


        #4
        Thanks for the followup - this secondary issue has also been fixed, for builds dated July 18 and later.

        Comment


          #5
          Hello,

          Thanks, but I have just tested with 12.0-p20190718 and the issue with the "localeFloat" item is still there. It is still only showing 2 decimals after focus and only 2 decimals after loosing focus.
          I have also tested with 12.1-d20190718 and here the issue is fixed for both float and localeFloat.

          Best Regards
          Rasmus

          Comment


            #6
            The fix has been ported back to 12.0 today - you'll see things working as expected in that version in tomorrow's build.

            Comment


              #7
              Great, thanks for your help.

              Comment

              Working...
              X