Quantcast
Channel: Recent Discussions — DataTables forums
Viewing all articles
Browse latest Browse all 82208

Datatables 2.0.0 - "Loading ..." message doesn't show custom message if no records on first load

$
0
0

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


Viewing all articles
Browse latest Browse all 82208

Trending Articles