You need to sign in to do that
Don't have an account?
suji srinivasan
backgroundcolour to LWC lightning datatable using css
Hi, background colour is not changing only text colour is getting changed for my lightning data table
.css:
tabletitle{
color: var(--light-theme-text-color,#e06000);
font-weight: bold;
}
.
.tablecss {
background-color: var(--light-theme-backgroud-color, lightcyan);
color: var(--light-theme-text-color, darkblue);
font-weight: bold;
}
html:
<template>
<template if:true={isSpinner}>
<div class="spinner">
<lightning-spinner alternative-text="Loading" size="medium"></lightning-spinner>
</div>
</template>
<lightning-card title="My Rewards" class="tabletitle">
<div class="tablecss">
<lightning-datatable data={salaryList} columns={cols} key-field="Id" >
</lightning-datatable> </div>
</lightning-card>
</template>
thanks in advance
.css:
tabletitle{
color: var(--light-theme-text-color,#e06000);
font-weight: bold;
}
.
.tablecss {
background-color: var(--light-theme-backgroud-color, lightcyan);
color: var(--light-theme-text-color, darkblue);
font-weight: bold;
}
html:
<template>
<template if:true={isSpinner}>
<div class="spinner">
<lightning-spinner alternative-text="Loading" size="medium"></lightning-spinner>
</div>
</template>
<lightning-card title="My Rewards" class="tabletitle">
<div class="tablecss">
<lightning-datatable data={salaryList} columns={cols} key-field="Id" >
</lightning-datatable> </div>
</lightning-card>
</template>
thanks in advance
Kindly refer this example for changing the background color of data table :-
https://www.salesforcetroop.com/datatable_styling_in_lwc
Kindly mark it as the best answer if it works for you.
Thanks & Regards,
Priya Ranjan