3

I am using JQuery Datatables. When the table renders , it shows as "No Data Available in the table", and after sometime the table starts appearing with data and this "No data Available" goes.

I dont want this "No data available to come", instead if Something like "Loading " or "Please wait" appears that will be great or nothing comes that will solve my problem.

Atul kumar singh
  • 454
  • 10
  • 24
  • You may use these example from https://datatables.net/reference/option/processing & https://datatables.net/reference/option/language.processing – Jacky Shek May 30 '16 at 09:51
  • I think you can use `oLanguage` -> `eEmptyTable:""` properties, as you can see the further discussion at [this stackoverflow discussion](http://stackoverflow.com/questions/14375771/how-to-show-empty-data-message-in-datatables) – hmd May 30 '16 at 09:53
  • [Refer this for showing empty data message in Datatables](http://stackoverflow.com/questions/14375771/how-to-show-empty-data-message-in-datatables) – Reshma Reghunatha Panicker May 30 '16 at 10:02

2 Answers2

4

Look here for complete reference -> https://datatables.net/reference/option/language the attributes you are looking for is loadingRecords, emptyTable and zeroRecords.

$("#example").DataTable({
  language: {
   emptyTable: "No data available in table", // 
   loadingRecords: "Please wait .. ", // default Loading...
   zeroRecords: "No matching records found"
  }
})

Angular dataTables :

$scope.dtOptions = DTOptionsBuilder.newOptions()
  .withLanguage({
    emptyTable: "No data available in table", 
    loadingRecords: "Loading...",
    zeroRecords: "A different no matching records message"
  })
davidkonrad
  • 83,997
  • 17
  • 205
  • 265
0

Because you tagged your question with angularjs, I suppose you are using the datatable module for angularjs.

So try to add to your table tag:

class="ng-cloak"

It prevents to display html before the table is ready (module is initializated):

AngularJS: ngCloak Official API doc

If you not, it could happen because you are using ajax() to get the data to inject in your table, so try to initialize your datatable plugin after your ajax call like in this example

Community
  • 1
  • 1
Nacho M.
  • 672
  • 4
  • 9