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 emptyMessage
property, but sho only the table empty. Anyone know how I can resolve this problem?
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.