0

I am populating a table in the reactjs.I have column there where i am showing numbers, now i have a requirement that after dot i always have to show 2 digits.enter image description here

Like in the above picture i have a value 26.1 but i have to show 26.10.

I have tried like below

<Column
      field={(object) =>
        object.amount !== null ? bsUtils.formatToUSD(object.amount).toFixed(2) : ""
      }
      field="amount"
      header="Amount"
      style={{ width: "10em" }}
    />

But i am not getting any result .Please help , i am new in react

Mandrek
  • 1,159
  • 6
  • 25
  • 55

1 Answers1

0
<Column
  field={(object) =>
    object.amount !== null ? (Math.round(object.amount * 100) / 100).toFixed(2): ""
  }
  field="amount"
  header="Amount"
  style={{ width: "10em" }}
/>

assuming you have your value in object.anount

Erick
  • 1,098
  • 10
  • 21