Im using Datatables with PHP and Mongo to make a CRUD.
This is my Code and it works fine
table = $('#example').DataTable({
    "bLengthChange": false,
    "ajax": "./get_clients"
});
This is my function to load new data and it works fine:
table.ajax.reload();
When I load the page I get a "Loading..." message, but when I reload with "table.ajax.reload()", I get no "Loading..." message which is annoying cause my users might not know the grid is loading.
I can add this line to my datatable params:
"processing": true,
And that would give me a "Processing..." Message with a different CSS style.
I'd like to know if there is a way to have the "Loading..." message with all of its properties while still using my reload ajax code.
Edit: Im' using version Data tables 1.10.10
Not really. The "Loading..." message is an actual table row that is added during initialisation, whereas the "Processing..." message is an overlay.
I suggest using the language feature to blank the "Loading..." message and just use the overlay:
$(document).ready( function () {
  var table = $('#example').DataTable( {
    ajax: '/ajax/arrays.txt',
    processing: true,
    'language':{ 
       "loadingRecords": " ",
       "processing": "Loading..."
    }
  } );
  $('#reload').click( function () {
    table.ajax.reload();
  } );
} );
You could of course not use   and set loadingRecords to an empty string, but that initial table row's height will collapse somewhat without.
Example: http://live.datatables.net/cepunoyi/1/edit
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With