We are using the (simplified) component/controller below but we want the view button to conditionally render. E.g. When record.boolean__c = true. Is there a way to do this using the lightning:datatable component?
I understand that these would render as lightning:button but I cannot see a method to dynamically render on either component.
/////////////
//Component//
/////////////
<lightning:datatable
columns="{! v.theColumns }"
data="{! v.theData }"
keyField="id"
onrowaction="{!c.handleRowAction}"
/>
//////////////
//Controller//
//////////////
doInit : function(component, event, helper){
component.set("v.productColumns",[
{label: 'Record Name', fieldName:
'Name',type: 'text', iconName: 'standard:product_item'
},
{type: 'button',
sortable: false,
typeAttributes: {
iconName: 'action:preview',
label: 'View',
name: 'viewRecord',
disabled: false,
}
},
{type: 'button',
sortable: false,
typeAttributes: {
iconName: 'action:new',
label: 'Add',
name: 'addRecord',
disabled: false,
}
}
]);
}