I have an LWC that fetch account records. I want to apply some CSS to the table headers.
.html
<template>
<lightning-card title="Datatable styling in lwc">
<!-- Only load this if data is available -->
<template if:true={tableData}>
<lightning-datatable
key-field="Id"
data={tableData}
columns={columns}
hide-checkbox-column
>
</lightning-datatable>
</template>
</lightning-card>
</template>
.js
import { LightningElement, wire } from 'lwc';
const COLUMNS = [
{label:'Account Name', fieldName: 'Name', cellAttributes:{ class: 'test-css'}},
{label:'Annual Revenue', fieldName: 'AnnualRevenue', type: 'currency',
cellAttributes:{ class: 'test-css'}
},
.css
.test-css {
color: blue;
background-color: black;
}
the rest of the code works fine. It is just the css that is not working.
className
instead ofclass