[SalesForce] how to show currency symbol instead of 3-letter code in LWC datatable column

I have a datatable with a currency column. My column definition is:


summaryDataColumns = [
    {
      type: "text",
      label: "Summary",
      fieldName: "sumName"
    },
    {
      type: "text",
      label: "Taxes",
      fieldName: "taxName",
      hideDefaultActions: true
    },
    {
      type: "currency",
      label: "",
      fieldName: "subtotal",
      hideDefaultActions: true,
      typeAttributes: {
        currencyCode: "USD"
      }
    }
  ];

the currency column shows something like USD 300.00. I need to show the currency symbol instead of the currency code. Something like $ 300.00 is what I need. How do you do it?

update Oct 20: my updated columns definition is:


  summaryDataColumns = [
    {
      type: "text",
      label: "Summary",
      fieldName: "sumName"
    },
    {
      type: "text",
      label: "Taxes",
      fieldName: "taxName",
      hideDefaultActions: true
    },
    {
      type: "currency",
      label: "",
      fieldName: "subtotal",
      hideDefaultActions: true,
      typeAttributes: {
        currencyCode: "USD",
        currencyDisplayAs: "symbol"
      }
    }
  ];

however, it does not seem to make any difference in the lwc datatable. 3 letter code still showing up:
enter image description here

Best Answer

To display the value as $ num instead of USD num, include currencyDisplayAs: "symbol" in the typeAttributes.

For more details on data table type attributes, refer to Formatting with Data Types section here.


Ref screenshot for USD formatted display:

enter image description here

Related Topic