mui-datatables icon indicating copy to clipboard operation
mui-datatables copied to clipboard

Is there a way to display total amount in a format with thousand digits without changing the data type (number) of the total amount

Open forjen127 opened this issue 3 years ago • 0 comments

Is there a way where I could still display the total amount with the thousand digits without changing its data type?

Expected Behavior

Display the total amount in a format with a thousand digits without it converting into a string. Formatting it like this: {totalAmount.toLocaleString(navigator.language, { minimumFractionDigits: 2, })}

Current Behavior

If I use the customBodyRender to format it like this {value.toLocaleString(navigator.language, { minimumFractionDigits: 2, })} this will return a string, hence, I would not be able to calculate the sum of all the total amount. Is there a way where I could still display it with a thousand digits without affecting the original value of the total amount?

Steps to Reproduce (for bugs)

https://codesandbox.io/s/xenodochial-fog-s984v0?file=/src/App.js

Your Environment

Tech Version
Material-UI 5.5.0
MUI-datatables 4.1.2
React 17.0.2
browser Google Chrome
etc

forjen127 avatar Mar 15 '22 10:03 forjen127