1

I have the below column in a lightning datatable. I'm trying to remove the padding-right in the of the lightning datatable. I added this cellAttribute, but there is still a lot of space in the padding-right of the table head. Any idea how I can get the lightning datatable to honor the slds class set in cellAttributes?

JS:

const columns = [
    {
        label: 'First Name',
        fieldName: 'FirstName',
        type: 'text',
        // fixedWidth: 150,
        cellAttributes: {
            class: 'slds-p-right_none',
        },
    },
...

HTML:

<div style="display: flex;">
                    <div style="min-height: 170px; max-height: 220px; flex: 1;">
                        <div style="height: 100%; max-width: 100%;">
                            <lightning-datatable
                                    data={data}
                                    columns={columns}
                                    key-field="Id"
                            >
                            </lightning-datatable>
                        </div>
                    </div>
                </div>
1
  • Have you tried inspecting the html/css to see what's causing the padding you're seeing?
    – Nick C
    Commented Feb 7, 2023 at 22:25

1 Answer 1

1

I used hideDefaultActions: 'true' on each object in columns. This got rid of the arrows inside the lightning-datatable header, which got rid of the extra padding. That property isn't outlined in the lightning-datatable docs, which is strange

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .