Search code examples
salesforcesalesforce-lightningaura-framework

How to highlight cell conditionally in aura component datatable?


I am building a lightning datatable with Aura component and I am showing data in this table from external system and I want to select one or more record so that I can import selected data in salesforce and after importing I want to to highlight that rows which had selected and imported in salesforce.


Solution

  • enter image description hereWhen you import data from external source than add an extra key value in json or js-object.,let's say isExternal which has value =''slds-theme_success" and use it is cellAttributes in lightningdatable, you can use cellAttributes in each column to highlight whole row. Ex:-

    Columns=[{ label: 'test', fieldName:'test' , cellAttributes:{class: { fieldName: 'isExternal' }} } ]; enter image description here