I have a lightning datatable and into one column called 'Set Primary Contact' I want to display an icon if the custom field IsPrimaryContact__c has the value TRUE, or a button 'Set primary contact' if the field has the value FALSE.
I managed to display only the button and to disabled it if the IsPrimaryContact__c is TRUE.
Below is the code for this column setting...
{type: "button", label: 'Set Primary Contact', typeAttributes: {
label: 'Set Primary Contact',
variant: 'brand',
name: 'Set Primary Contact',
title: 'Set this contact as Primary Contact',
disabled: { fieldName: 'IsPrimaryContact__c'},
value: 'Set Primary Contact',
iconPosition: 'left',
onclick: ''
}}
Thank you!
Later Edit: This is an Aura component