javascript 如何使用 dataTables.js 库隐藏“显示 N 个条目中的 1 个”

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/19438226/
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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-27 15:35:35  来源:igfitidea点击:

How to hide "Showing 1 of N Entries" with the dataTables.js library

javascriptdatatables

提问by nickL

How do you remove the "Showing 1 of N entries" line of text on a dataTable (that is when using the javascript library dataTables? I think I was looking for something along these lines...

您如何删除数据表上的“显示 N 个条目中的 1 个”文本行(即使用 javascript 库数据表时?我想我正在寻找这些方面的内容......

 $('#example').dataTable({
      "showNEntries" : false
       });

Pretty sure this is a simple one, but cannot seem to find it in the docs.

很确定这是一个简单的,但似乎无法在文档中找到它。

回答by BMH

You can remove it with the bInfooption (http://datatables.net/usage/features#bInfo)

您可以使用bInfo选项将其删除(http://datatables.net/usage/features#bInfo

   $('#example').dataTable({
       "bInfo" : false
   });

Update:Since Datatables 1.10.* this option can be used as info, bInfostill works in current nightly build (1.10.10).

更新:自 Datatables 1.10.* 起,此选项可用作infobInfo在当前每晚构建 (1.10.10) 中仍然有效。

回答by Arian Acosta

To disable the drop down set the lengthChangeoption to false

要禁用下拉列表,请将lengthChange选项设置为false

$('#datatable').dataTable( {
  "lengthChange": false
} );

Works for DataTables 1.10+

适用于数据表 1.10+

Read more in the official documentation

官方文档中阅读更多

回答by Irf

Now, this seems to work:

现在,这似乎有效:

$('#example').DataTable({
  "info": false
});

it hides that div, altogether

它隐藏起来div,完全

回答by mamal

try this for hide

试试这个隐藏

$('#table_id').DataTable({
  "info": false
});

and try this for change label

并尝试此更改标签

$('#table_id').DataTable({
 "oLanguage": {
               "sInfo" : "Showing _START_ to _END_ of _TOTAL_ entries",// text you want show for info section
            },

});