I am building an aura lightning:datatable.
For flexibility I am specifying each column definition in a custom metadata type record so that when a column needs to be added or removed, have its title changed or position changed etc, it can be done by amending custom metadata rather than requiring development and deployment.
It works well, except where the attribute value is an object, like typeAttributes, which I need to set for url columns.
If I retrieve the typeAttributes value from a custom metadata type field it has no effect on the display.
If I write the definition directly in my helper then I get the result that I want.
const columnsTemp = [
{label: 'First Name', fieldName: 'localPolicyId', type: 'text', sortable: true},
{label: 'Website', fieldName: 'customer', type: 'url', sortable: false, typeAttributes: { label: { fieldName: 'customer' }, target: '_blank', tooltip: 'Click to visit website' }}
]
So it seems that retrieving the typeAttributes value as text doesn't work.
Any suggestions on how to specify the typeAttributes value in the custom metadata type record? The typeAttributes object itself contains an object for the label property so need to be able to handle that too.