+ Start a Discussion
Julien SalensonJulien Salenson 

lightning:datatable number without digits

Hi,

I have used a lightning:datatable and I want to format number in a column.

Today, i  my controller, I use :
{label: 'My number', fieldName: 'my_number', type: 'currency',sortable : true
},

My result is :
123,00 €

And I want to have :
123 €
=> No digit allowed after the commat.

Is there a way to do that ?

Thanks for your help,
Julien
Deepali KulshresthaDeepali Kulshrestha
Hi Julien,


This might help you :
<aura:component>

    <p><lightning:formattedNumber value="123456789012345" style="currency" currencyCode="EUR"  maximumFractionDigits="0"/></p>

</aura:component>

 maximumFractionDigits - this will decide how many decimal digits are allowed in your number.

For more information about the formatting of number in Lightning read the document below:

https://developer.salesforce.com/docs/component-library/bundle/lightning:formattedNumber/example


I hope you find the above solution helpful. If it does, please mark as Best Answer to help others too.

Thanks and Regards,
Deepali Kulshrestha
www.kdeepali.com
Julien SalensonJulien Salenson
Hi Deepali,

Thanks for your answer. But it doesn't work.

If I try your code, the result is : 123 456 789 012 345,00  €.

And I want to remove ",00"

Regards