Datatables 2.0.0 - "Loading ..." message doesn't show custom message if no records on first load
Datatables 2.0.0 - "Loading ..." message doesn't show custom message if no records on first load
Hello all, I have a simple table that shows a custom message if it's empty:
book_listing_table = $('#booktable').DataTable({
language: {
emptyTable: "No books available. <a href='/book/new'>Create one?</a>"
},
...
ajax: {
url: "/book/datatables/active",
type: "POST",
dataType: "json"
},
...
On initial page load, my ajax call returned this (which was valid):
{
"data": [],
"recordsFiltered": 0,
"recordsTotal": 0
}
If the ajax call returns no data, when I first go to the page, the "Loading ..." message stays stuck, i.e. the "no books available" message is not shown.
If I change the search filter, e.g. add an "x" to the filter, the message "No books available. Create one?" is shown as expected, and the same data is returned from the ajax call.
Prior to the upgrade to 2.0.0, the "No books available. Create one?" message was shown on initial page load. I can't see anything obvious I've missed in the configuration. Hopefully someone can point me in the right direction.
Thank you very much! Jeff
Replies
Hi Jeff,
Apologies for the error. I've actually committed a fix for this issue already and it will be in 2.0.1 which will drop soon (by Tuesday at least). The fix is in the nightly builds if you want to use it immediately.
Allan
Hi @allan -- thank you very much, as always. Let me know if there is a better place to report issues, managing a public forum like this can become overwhelming. Cheers!
This is the best please.
Yup! But if it wasn't here, it would just be overwhelming somewhere else
Allan
Just updated to 2.0.0 and seen this behavior today. Thank @allan for quick action.
I updated to 2.0.1 today and the message now appears as expected. Thank you for the fix! I believe this issue can be closed. Regards, jz
Glad to hear the update resolved the issue! Your feedback helps improve the product for everyone. If you encounter any more issues or have further feedback, don't hesitate to reach out.