You need to sign in to do that
Don't have an account?
balram kamboj 10
Number-to-Percent In Lightning Datatable
I have a Increment__c custom field with data type number(15, 0) and it has a values of 2
I am trying to fetch and display the value 2 in standard datatable under "Increment" column.
But my datatable showing value as 200% instead of 2%, which is multiplying the value with 100.
If i give type: 'number' in JS my datatable playground is displaying correct value like 2 but i want to display the % symbol for each value in the "Increment" column like 2%.
Please give me suggestions to achieve this.
Thanks
B
I am trying to fetch and display the value 2 in standard datatable under "Increment" column.
{ label: 'Increment', fieldName: 'Increment__c', type: 'percent', cellAttributes: {alignment: 'center'}}
But my datatable showing value as 200% instead of 2%, which is multiplying the value with 100.
If i give type: 'number' in JS my datatable playground is displaying correct value like 2 but i want to display the % symbol for each value in the "Increment" column like 2%.
Please give me suggestions to achieve this.
Thanks
B
Displaying Currency and Percentages:-
Currency type displays a value based on the org currency and your Salesforce locale by default.
To override the default currency code, pass in a custom currencyCode value.
To specify the granularity on a currency or percentage for inline editing, pass in the step attribute. For example, specify step: 0.01 to allow numbers with two decimal places, or step: 0.001 permits three decimal places. Specify step: 1 to require whole numbers. The default is 0.01. You can preserve the number of fraction digits for display using minimumFractionDigits and maximumFractionDigits.
For example, if you pass in confidence: 0.21234 in your column data, the display value is 21.234%. When you inline edit, the step value is used to determine if your input is valid. If you pass in confidence: 0.78, the display value is 78.00% because minimumFractionDigits is set to 2.
if you need any assistanse, Please let me know!!
Kindly mark my solution as the best answer if it helps you.
Thanks
Mukesh