Answers for "salesforce datatable icon"

0

salesforce datatable icon

{label: 'Provenance', fieldName: 'prYou can try declaring your column similar to whats shown below (providing a fieldname to be used in the js controller/helper to set the iconName)
{label: 'Provenance', fieldName: 'provenance'  cellAttributes:
                { iconName: { fieldName: 'provenanceIconName' }, iconLabel: { fieldName: 'provenanceIconLabel' }, iconPosition: 'right' }}
//and just before you set the list of records which you are going to pass it to datatable's "data"  attribute if you try and set the icon based on the rowData you have, you should be able to achieve icon based on condition
//setIcon: function (cmp, dataList) {
       // dataList you retrieved from server side callback or the data you want to display in the table
        dataList = dataList.map(function(rowData) {
            if (rowData.provenance === 'value') {
               rowData.provenanceIconName = 'utility:up';
               rowData.provenanceIconLabel = 'up';
            } else {
               rowData.provenanceIconName = 'utility:down';
               rowData.provenanceIconLabel = 'down';
           }
            return rowData;
        });
        cmp.set("v.dataList", dataList);
    }ovenance'  cellAttributes:
                { iconName: { fieldName: 'provenanceIconName' }, iconLabel: { fieldName: 'provenanceIconLabel' }, iconPosition: 'right' }}
Posted by: Guest on May-09-2021

Code answers related to "Javascript"

Browse Popular Code Answers by Language