我正在使用jQuery数据表。

我想删除默认情况下添加到表中的搜索栏和页脚(显示有多少行可见)。我只是想用这个插件来排序。这能做到吗?


当前回答

如果你正在使用自定义过滤器,你可能想隐藏搜索框,但仍然想启用过滤器功能,所以bFilter: false不是方法。使用dom: 'lrtp'代替,默认是'lfrtip'。文档:https://datatables.net/reference/option/dom

其他回答

你可以通过css隐藏它们:

#example_info, #example_filter{display: none}

请访问http://www.datatables.net/examples/basic_init/filter_only.html查看要显示/隐藏的特性列表。

你想要的是将“bFilter”和“bInfo”设置为false;

$(document).ready(function() {
    $('#example').dataTable( {
        "bPaginate": false,
        "bFilter": false,
        "bInfo": false
                 } );
} );

没有过滤输入控件。(https://datatables.net/reference/option/dom)

    /* Results in:
        {length}
        {processing}
        {table}
        {information}
        {pagination}
    */
    $('#example').dataTable( {
      "dom": 'lrtip'
    } );

#table是表的Id

$('#table').dataTable({searching: false, paging: false, info: false});

如果你正在使用themeroller:

.dataTables_wrapper .fg-toolbar { display: none; }