Skip to main content

The documentation for lightning-datatable Lightning Web Component says that it should fill the hiehgt of its parent container however, I'm unable to get it to take up the entire height when its loading records or when there aren't enought rows to make it scroll. Also, see how the spinner is mostly hidden.

I have tried hard coding the parent's height to see if it worked like the following:

<div class="body" style="height:500px;">

            <lightning-datatable

                    key-field="TransactionReferenceNumber"

                    data={transactions}

                    columns={columns}

                    is-loading={isRefreshing}

                    enable-infinite-loading

                    onloadmore={accountTransactionsJS}

                    sorted-by="RtxnNumber"

                    onrowaction={showDetails}>

            </lightning-datatable>

        </div>

I originally used the CSS class to set the height of body (the container) to 100%.

div.body{

    max-height: 100%;

    min-height: 100%;

    height: 100%;

    border-bottom: 1px solid rgb(221, 219, 218);

}

How do I set the height?

Set height of LWC lightning-datatable
2 respostas
  1. 16 de dez. de 2019, 16:54
    Were you able to determine a solution to this issue? I'm having the same problem with the spinner barely being visible but can't find a way to set a min-height on the table. 
0/9000