[Data Grid Reactive] Numeric format in Reactive
Forge component by OutSystems R&D
Application Type
Reactive

When i add a integer value in tha datagrid (Into NumericColumn or TextColumn" the grid is formatting this with a thousand-seperator. We have no possibility to use the build-in-function "FormatDecimal".

How can i get a numeric value into the grid without formatting?

Or is it possible for you to add possibility for us to use a function to format values between the json and the UI? 

Hello @Stein Jørgen Dahle,

Currently we don't have a public API to set up the Number format. 

To avoid the thousands separator, you can add these two JS rows in the OnReady event of the page that has your grid:

GridAPI.ColumnManager.GetColumnById($parameters.ColumnId)._provider.format = "f 0"

GridAPI.ColumnManager.GetColumnById($parameters.ColumnId)._editor.format = "f 0";

The parameter ColumnId should be your number column id:

We know this isn't the ideal solution.

To build a solid solution, how do you see this configuration being set? At the column level, at the grid level? An input parameter, a client action?

Hope to hear your feedback,

Bruno Martinho

Thank you, I will give you a feedback as soon as possible

Being able to set the numerical format at the column level is critical for me. Being able to put a formula in the binding would be the best, like Concat("LOC-" + {Entity}.[FieldName]).

Hello @Joseph Marlin ,

To achieve this requirement, like concat, you'll have to  the one setting that using cell template.

The result:

In attachment, you can find a sample OML with this implementation.

Please keep in mind that this hasn't been tested for all possible use cases or that it cover all of your requirements, so we cannot assure that it will work for all use cases.

Please let us know if this helps.

Bruno Martinho

Prefix.gif

Hi @bruno,


I'm facing the same scenario but above solution is not working. still getting comma separated values.

Hello @Sugu,

Please check the attached OML, it was used to build this grid:

Please let us know if this helps.

Bruno Martinho

NumericFormat.oml

Hi Bruno,

Thanks for the quick reply. Mentioned JS is working fine on chrome console, but i have grid both on block and screen when i try to apply the JS on the screen grid it is not working. 

Hello,

Can please you share any kind of sample or provide more details?

We are not able to understand the use case so we can help in a better way.

Thanks,

Bruno Martinho

Hi Bruno,

I'm not using updated DataGrid


I think my JS mentioned on OnReady event, not reflecting on the grid. Trying to create a sample for this. 

mvp_badge
MVP

Hi Bruno,

Thanks for your workaround.

The second command raises a "Cannot set format to undefined" exception.

GridAPI.ColumnManager.GetColumnById($parameters.ColumnId) ._ editor.format = "f 0";

I removed it, it worked... but when I access the screen again, the value is without the comma, blinks and the comma returns :(.

When navigating to another screen and returning, it is ok again.


Thanks,

Leandro.

Hello Leandro.

Can you please check the OML in attachment and try it on your side?

Please let us know if this helps.

Bruno Martinho

NumericFormat.oml

mvp_badge
MVP

Hi, Bruno!

Forget it! Today is working ok :D

I don't know what was happened.


Thanks,

Leandro.


Hi @Bruno Martinho 

I found the same issue where the format was not applied when I perform a F5 on screen.
I have included the same JavaScript under OnRender event and it resolves the issue.

Would this be an appropriate solution?

Regards,
Soon

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.