0

I've tried this in two ways:

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 table"
        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 .table{
     text-align: center;
}
4

This should not be super difficult give your datatable a class e.g. table-test then in a style section of a component add

.THIS .table-test thead th span {
background-color: #16325c;
color: white}

The result should be:

enter image description here

Bear in mind there are hover events that you also have to override.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.