Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Showing custom message in jquery datatable while loading data?

I have below code in jsp to create a dataTable. I am using bProcessing as true which displays the 'processing' indicator till i get the data from the server. I want to show the message as "loading data.." instead of 'processing'. I tried using sProcessing as suggested on various sites but it does not work?

      customersTable = $('cutomer').dataTable({
         "sAjaxSource": "ajax url",
         "bProcessing":true,
         "bDeferRender": true,
         "sServerMethod": "POST",
             "oLanguage": {
                "sProcessing": "loading data..."
              }
      });
like image 286
emilly Avatar asked Dec 21 '22 12:12

emilly


2 Answers

 "oLanguage": {
          "sProcessing": "loading data..."
   } 

works for me and also suggested in dataTable Api's http://datatables.net/ref. Just check whether you are putting at right place. Otherwise you can also try fnPreDrawCallback and fnDrawCallback

like image 106
M Sach Avatar answered Dec 26 '22 19:12

M Sach


You could try sLoadingRecords instead of sProcessing, as sLoadingRecords deals with loading data, and sProcessing deals with datatables sorting/searching local data. Since you are using server side processing, I'm don't think sLoadingRecords will work for you, but it might actually change the text for you.. Let us know it it works for you.

Here's the info on sLoadingRecords from the DataTables website.

When using Ajax sourced data and during the first draw when DataTables is gathering the data, this message is shown in an empty row in the table to indicate to the end user the the data is being loaded. Note that this parameter is not used when loading data by server-side processing, just Ajax sourced data with client-side processing.

And for sProcessing

Text which is displayed when the table is processing a user action (usually a sort command or similar).

like image 32
GameCharmer Avatar answered Dec 26 '22 19:12

GameCharmer