Javascript 想要在数据表中显示加载程序 GIF
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/5648643/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Want to show loader GIF in datatables
提问by no_freedom
I'm using datatables. My code is working fine. Now I want to add a loader image (gif). I don't know how to add this. Here is my datatable script so far.
我正在使用数据表。我的代码工作正常。现在我想添加一个加载程序图像(gif)。我不知道如何添加这个。到目前为止,这是我的数据表脚本。
$(document).ready(function() {
$("#dvloader").show();
oTable = $('#example').dataTable({
"bJQueryUI": true,
"sPaginationType": "full_numbers"
});
});
Here is my loader:
这是我的装载机:
<div id="loader">
<img src="ajaxloader.gif" />
</div>
回答by anupam
回答by akosel
In datatables 1.10 and onwards, you should use:
在数据表 1.10 及更高版本中,您应该使用:
$('#example').dataTable({
language: {
processing: "<img src='loading.gif'>"
},
processing: true
});
Not required as of today, but more standard given the new documentation. The project changed from using Hungarian notation to standard camelCasein the most recent update. Of interest:
今天不需要,但考虑到新文档,标准更高。在最近的更新中,该项目从使用匈牙利符号更改为标准驼峰命名法。出于兴趣:
Please note that the Hungarian notation option is deprecated and will be removed in future versions of the extensions (on the extension's next major version update - i.e. 1.x to 2.x, although 2.x is not planned for a long time to come - plenty of life in the 1.x series still!). The documentation for the extensions will be updated to remove the Hungarian notation before that point.
请注意,匈牙利表示法选项已弃用,并将在扩展的未来版本中删除(在扩展的下一个主要版本更新中 - 即 1.x 到 2.x,尽管 2.x 并没有计划在很长一段时间内- 1.x 系列仍然充满活力!)。扩展的文档将更新以在此之前删除匈牙利符号。