formatter

Questionsformatter
Georges asked 7 days ago

Hi,

 

I have a problem with % formatter

inside my database, values are for example  0.06520, all datas with 5 decimals maximum

I would like to dispaly  6.52%

but sometimes formatter display things like that 6.52000000000001%  or  6.519999999998%

I use:

$col[“formatter”] = “function(cellval,options,rowdata){ return cellval*100+’%’; }”;

 

 

what do i wrong ?

Thanks

 

 

 

3 Answers
Georges answered 7 days ago

I’ve tried this:
$col[“formatter”] = “function(cellval,options,rowdata){ return Intl.NumberFormat(‘fr-FR’, {style: ‘percent’, minimumFractionDigits: 2, maximumFractionDigits: 2,}).format(cellval);}”;

it’s OK for display
but not to modify data

ex:
58,14% displayed
but 58,14 % when I want to modify cellvalue

how to unformat correctly?

Georges

Georges answered 7 days ago

I’ve tried this:
$col[“formatter”] = “function(cellval,options,rowdata){ return Intl.NumberFormat(‘fr-FR’, {style: ‘percent’, minimumFractionDigits: 2, maximumFractionDigits: 2,}).format(cellval);}”;

it’s OK for display
but not to modify data

ex:
58,14% displayed
but 58,14 % when I want to modify cellvalue

how to unformat correctly?

Georges

Georges answered 7 days ago

grhhhh displayed when I wxhant to change data: 58,14  \’ \’  %

Your Answer

18 + 18 =

Login with your Social Id:

OR, enter

Attach code here and paste link in question.
Attach screenshot here and paste link in question.



How useful was this discussion?

Click on a star to rate it!

Average rating 0 / 5. Vote count: 0

No votes so far! Be the first to rate it.

We are sorry that this post was not useful for you!

Let us improve this post!

Tell us how we can improve this post?