emptyMessage property doesn't show
Asked Answered
H

1

6

I need to show a message when the lista data value is empty:

 <p-table [value]="listElement" [paginator]="true" [rows]="10" [rowsPerPageOptions]="[5,10,20]" [showCurrentPageReport]="true" emptyMessage="No record found">
                    <ng-template pTemplate="header">
                        <tr>
                            <th>Code</th>

                        </tr>
                    </ng-template>

                    <ng-template pTemplate="body" let-elements>
                        <tr>
                            <td>{{elements.code}}</td>

                        </tr>
                    </ng-template>
                </p-table>

The problem that when the listElement is empty it doesn't show the message in emptyMessageproperty, but sho only the table empty. Anyone know how I can resolve this problem?

Hann answered 11/5, 2020 at 10:4 Comment(0)
A
9

probably you understand emptyMessage specific wrong. As you can see here https://primeng.org/table#samples (scroll to Empty Message section in the html file). You have to create template like <ng-template pTemplate="emptymessage" let-columns> and put there markup which will displays if value property is empty. Try to do it and please share your feedback, I'm interested will it work or not, if not we can think about problem more.

Appulse answered 11/5, 2020 at 10:52 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.