-
Notifications
You must be signed in to change notification settings - Fork 490
Empty table - "No matching records found" in angular 6 #1260
Comments
Same issue here! Found a work around but sure this is not the best solution.
|
Thank you for the solution but sure this is a temp fix. We can wait for "l-lin" reply for this issue. Thank you. |
You might want to add the css style like in this example: .dataTables_empty {
display: none;
} and display your own message if there is no record: <tr *ngIf="persons?.length == 0">
<td colspan="3" class="no-data-available">No data!</td>
</tr> |
Any word on a real fix here? Both solutions are ok, but it seems like the package should handle this just fine out of the box. |
Hi l-lin, using is styles fine for initial load. when I want to use the search box for filter the rows its not showing records not found OR no data . from the example I searched the "444444" text in the box, got no message or nothing. |
Hi all, Solution:
if (this.tablesInitialised[2]) {
//second time
this.datatableElement.forEach((dtElement: DataTableDirective, index: number) => {
if (index === 2) {
if (typeof dtElement.dtInstance !== 'undefined') {
dtElement.dtInstance.then((dtInstance: DataTables.Api) => {
dtInstance.clear();
dtInstance.destroy();
});
}
}
});
this.unscoredData = unscored;
this.dtTrigger2.next();
} else {
//first time
this.tablesInitialised[2] = true;
this.unscoredData = unscored;
let catInterval = setInterval(() => {
if (document.querySelectorAll('#category-tab tbody tr').length > 0) {
clearInterval(catInterval);
setTimeout(() => {
this.datatableElement.forEach((dtElement: DataTableDirective, index: number) => {
if (index === 2) {
if (typeof dtElement.dtInstance !== 'undefined') {
dtElement.dtInstance.then((dtInstance: DataTables.Api) => {
dtInstance.clear();
dtInstance.destroy();
});
}
}
});
this.dtTrigger2.next();
}, 1000);
}
}, 500);
} write this above code when the new data is available in table. |
Thank you @ussamoo it's working and I successfully removed the “No matching records found” from my table. |
Hi,
I followed your tutorial (https://l-lin.github.io/angular-datatables/#/basic/server-side-angular-way) except the styles because if search something, then no records found we must show the notification message.
Everything working fine, but by default I am getting the message "No matching records found" even though I have records. Can you please help me to solve this issue.
Environment
Thank you,
Peri
The text was updated successfully, but these errors were encountered: