如何删除 jQuery DataTables 插件添加的搜索栏和页脚? [英] How can I remove the search bar and footer added by the jQuery DataTables plugin?
问题描述
我正在使用 jQuery 数据表.
我想删除默认添加到表格中的搜索栏和页脚(显示有多少行可见).我只是想使用这个插件进行排序,基本上.可以这样做吗?
I want to remove the search bar and footer (showing how many rows there are visible) that is added to the table by default. I just want to use this plugin for sorting, basically. Can this be done?
推荐答案
对于 DataTables >=1.10,使用:
$('table').dataTable({searching: false, paging: false, info: false});
如果您仍然希望能够使用此插件的 .search()
功能,则需要隐藏"带有 dom
设置的搜索栏 html:
If you still want to be able the .search()
function of this plugin, you will need to "hide" the search bar html with the dom
setting:
$('table').dataTable({dom: 'lrt'});
默认值为 lfrtip
或 <"H"lfr>t<"F"ip>
(当 jQueryUI
为真时), f
char 代表dom中的过滤器(搜索)html,ip
代表信息和分页(页脚).
The defaults are lfrtip
or <"H"lfr>t<"F"ip>
(when jQueryUI
is true), f
char represents the filter (search) html in the dom, ip
for the info and pagination (footer).
对于 DataTables <1.10,使用:
$('table').dataTable({bFilter: false, bInfo: false});
或使用纯 CSS:
.dataTables_filter, .dataTables_info { display: none; }
这篇关于如何删除 jQuery DataTables 插件添加的搜索栏和页脚?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!