0

I have lightning data table with one of the columns associated to Amount field. I want amount values to appear with '$' symbol for which I declared Amount column with type 'Currency' but I was not able to see amount values with '$' or any other currency symbol. As a workaround, I converted the data type of Amount to String and concatenated the '$' symbol :

Column Declaration : const columns = [{ fieldName: "Amount", hideDefaultActions: true, label: "AMOUNT", type: "String", sortable: "true" }];

Evaluation of Amount value : rowData.Amount = "$" + (((obj.amount / 100) + '').indexOf('.') == -1 ? (obj.amount / 100) + '.00' : (obj.amount / 100));

But with this workaround, sorting on Amount field is not working as expected. I am using following code for sorting : enter image description here

Lightning Datatable html part :

enter image description here

I need both sorting and display of amount values with currency symbol to be working correctly. Any help would be highly appreciated.

1
  • it will be "currency" not "Currency" JS in case sensitive
    – User6670
    Jul 28, 2020 at 5:25

1 Answer 1

0

Use currency with small 'c' as the datatype, you would get the symbol.

1
  • Thanks, it's working now Jul 28, 2020 at 6:05

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .