You need to sign in to do that
Don't have an account?
beingofhabits
How to apply css to headers of a lightning:datatable?
I've tried this in two ways:
First:
But neither of it works. Is it possible at all?
If needed, I here is my CSS as well
First:
component.set("v.columns",[ {label:'', fieldName:'edit', type:'action', class: 'cols', cellAttributes: { iconName: { fieldName: 'utility:custom_apps' }}}, ... ]);Second:
<lightning:datatable data="{! v.data }" class="cols" columns="{! v.columns }" keyField="id" resizeColumnDisabled="true" hideCheckboxColumn="true"/> </lightning:card>
But neither of it works. Is it possible at all?
If needed, I here is my CSS as well
.THIS .cols { background-color: #16325c; color: white; }
This should not be super difficult give your datatable a class e.g. table-test then in a style section of a component add The result should be:
Bear in mind there are hover events that you also have to override.
Hope this helps.
Kindly mark this as solved if the reply was helpful.
Thanks,
Nagendra
All Answers
This should not be super difficult give your datatable a class e.g. table-test then in a style section of a component add The result should be:
Bear in mind there are hover events that you also have to override.
Hope this helps.
Kindly mark this as solved if the reply was helpful.
Thanks,
Nagendra
How would you disable the hover styling events?