I'm trying to create a Lightning datatable in Salesforce that displays a status value and a clickable button icon in the same column similar to the task recent view table.
The button should be different depending on the value of the status field (i.e. "Open" or "Complete"). I've tried using the type: 'button-icon' column type with typeAttributes to dynamically set the button icon and label based on the status value, but it doesn't seem to be working correctly.
Is there a way to achieve this functionality with a single column in the Lightning datatable? Or do I need to create separate columns for the status value and the button icon? Any advice or suggestions would be greatly appreciated. Thank you!
Best Answer
You can use an htm table and an apex helper class...try the code below
Apex:
}
JS:
HTML:
Result: