[Data Grid] How to use decimals

Forge Component
(28)
Published on 24 Sep (3 weeks ago) by OutSystems R&D
28 votes
Published on 24 Sep (3 weeks ago) by OutSystems R&D

I want to be able to edit decimals but I'm unable to succeed.What I have done is the following;

  1. Create a REST that provides a JSON that returns the needed data format (including decimals) and consume it with Data Grid
  2. Added a "Grid Column Number" to the Grid and bound it to the correct JSON property

When I view the data grid I see the correct numbers. 1.123456 for instance. But the moment I edit the value it defaults to whole numbers only so everything after the dot is truncated. So I'm left with just a single 1. 

I also tried to use the "Grid Column Currency" but that also didn't result in the correct behavior. I can now edit the value but the value is displayed with a rounded number. So 1.123456 is shown as 1.12. That is not good enough for our use case. 

I tried diving into the documentation of Wijmo Flexgrid but I'm a bit overwhelmed. Does anyone have a solution for me that I can use?

Edit: I have been able to add a fixed number of decimals by adding "format\: 'n4'" to the "AdvancedFormat property. This does however not allow me to edit decimals since the default edit box only allows whole numbers. This edit box however looks like a custom component since if I may believe the documentation of FlexGrid this is not the default behavior; 

The edit window looks like this. 

Hello Vincent,
Try it out, make sure this behavior is related to client-side formatting. Well, the documentation talks about the date format. See the following link:

https://outsystemsui.outsystems.com/DataGridSample/Formatting.aspx




I am fairly sure it's client side related, and I also fairly sure that it isn't causes by a setting in Service Center. It's to bad I can't open Data Grid from within Service Studio to figure out what I can do exactly with all the possible AdvancedFormat and the OSCellRendere. I think I need to find my solution in those 2 properties.

Use the client side formatting component.

Hello Vincent,


You are correct in adding the format property to the AdvancedFormat on the column. However, the current code of the Grid isn't ready to accept decimals when you edit a column, hence why your numbers keep reverting to whole numbers.


The next release will have this fixed and then you can add decimals via AdvancedFormat option.


Regards,

Joana


Hi Joana,

Thank you for the update. Can you perhaps give an estimate on when we can expect the next version? This so that I can update my project team and manage expectations.

Kind regards,

Vincent

Hi Joana, 

I just noticed a new version that has support for decimal numbers. Thank you very much for this quick fix!

Best,

Vincent