Ho creato un componente LWC con i seguenti file
 
     
     File .HTML
 
    
 
    ...
<lightning-datatable
  key-field="id"
  data={data}
  columns={columnsInProgress}
  is-loading={tableLoadingState}
  hide-checkbox-column=true>
</lightning-datatable>
...
 
     
     file .js
 
    
 
    ...
const columnsInProgress = [
        { label: 'Opportunity', fieldName: 'OpportunityName', fieldName: 'oppUrl', type: 'url',
            typeAttributes: {label: { fieldName: 'OpportunityName' }, target: '_self'},
        },
        { label: 'Type', fieldName: 'OpportunityType', 
            cellAttributes: {class : {fieldName:'oppTypeClass'}}
        },
        { label: 'Stage', fieldName: 'OpportunityStage' },
        { label: 'Next Step', fieldName: 'OpportunityNextStep' }
    ];
...
 
    Incarico
 
    ...
if(row.lkpOpportunityActive__r.RecordType){
   rowData.oppTypeClass = row.lkpOpportunityActive__r.RecordType.Name == 'Retention'?'fontRed':'';
}
...
 
     
     .css
 
    
 
    td.fontRed {
    color: red;
}
 
    Ora la cella riceve l'applicazione della classe CSS ma il testo non cambia in ROSSO perché il file CSS non viene applicato in qualche modo. Come possiamo controllare e applicare dinamicamente il CSS?
 
     
     PRODUZIONE
 
    
 
    