0

can we display message when lightning data table is empty in LWC like below enter image description here

2

You can do this to result in the screenshot below. You'll need to have a variable called "empty" that holds whether there's data or not.

<lightning-datatable
    class="some-table"
    key-field="Id"
    data={data}
    columns={columnMappping}
    hide-checkbox-column
>
</lightning-datatable>
<template if:true={empty}>
    No data to display
</template>

Lightning data table with "no data" message

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.