最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Avoid Rendering "No Data Available in the table" in Datatables - Stack Overflow

programmeradmin4浏览0评论

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 e", instead if Something like "Loading " or "Please wait" appears that will be great or nothing es that will solve my problem.

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 e", instead if Something like "Loading " or "Please wait" appears that will be great or nothing es that will solve my problem.

Share Improve this question asked May 30, 2016 at 9:39 Atul kumar singhAtul kumar singh 4741 gold badge10 silver badges26 bronze badges 3
  • You may use these example from datatables/reference/option/processing & datatables/reference/option/language.processing – Jacky Shek Commented May 30, 2016 at 9:51
  • I think you can use oLanguage -> eEmptyTable:"" properties, as you can see the further discussion at this stackoverflow discussion – hmd Commented May 30, 2016 at 9:53
  • Refer this for showing empty data message in Datatables – Reshma Reghunatha Panicker Commented May 30, 2016 at 10:02
Add a ment  | 

2 Answers 2

Reset to default 4

Look here for plete reference -> https://datatables/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"
  })

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

发布评论

评论列表(0)

  1. 暂无评论