Announcement

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

    decimalPadding and decimalPrecision

    SmartGwt3.0p
    IE8

    DecimalPadding and DecimalPrecision don't seem to be working. We've added the properties to the ds.xml file for a field of type 'float'. We've tried with and without camel case with the same result.

    Can we get verification that these work, and if so, what the correct syntax is to use them in a ds.xml file?

    we've tried:
    decimalPadding
    decimalpadding
    decimalPrecision
    decimalprecision

    #2
    Also - why don't fields of type 'float' take into account locale info for grouping, decimal, etc? It seems we have to manually use GWT's NumberFormat class. Am I just missing something somewhere?

    Comment


      #3
      You should be able to just do
      Code:
         <field name="foo" type="float" decimalPrecision="2" decimalPad="2"/>
      within your .ds.xml file.
      However we realized that this isn't behaving as expected currently - the framework is failing to recognize that these values should be interpreted as numeric values.
      We'll get this fixed for mainline and 3.1 right away - should be resolved by the next nightly build.

      For older builds, you will need to explicitly indicate that you're working with numeric rather than string values. You can do this by writing JavaScript literal numbers into the .ds.xml file using this syntax:
      Code:
          <field name="foo" type="float">
             <decimalPrecision><JS>2</JS></decimalPrecision>
             <decimalPad><JS>2</JS></decimalPad>
          </field>

      Regards
      Isomorphic Software
      Last edited by Isomorphic; 24 Jan 2013, 10:26. Reason: fixed formatting

      Comment


        #4
        Thanks as usual for the speedy response!

        Quick followup - once padding and precision are working again, will this take into account locale for the fractional / decimal point?

        Comment


          #5
          Currently there's no built in logic to switch the decimal point indicator based on locale. You'll have to do this via a formatter for the field type.

          This is on our radar as something to roll into built in locale switching support in the future (so this manual step would become unnecessary) - but we don't yet have it.

          Comment


            #6
            Thanks.

            If we wanted to do this ourselves, would a new SimpleType be the best starting point?

            Comment


              #7
              Yes, a SimpleType would be a good way to reuse the same formatting logic in multiple DataSources and across all DataBoundComponents.

              Comment

              Working...
              X