How can I remove the search bar and footer added b

2019-01-10 00:56发布

I am using jQuery DataTables.

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?

17条回答
来,给爷笑一个
2楼-- · 2019-01-10 01:08

Check out http://www.datatables.net/examples/basic_init/filter_only.html for a list of features to show/hide.

What you want is to set "bFilter" and "bInfo" to false;

$(document).ready(function() {
    $('#example').dataTable( {
        "bPaginate": false,
        "bFilter": false,
        "bInfo": false
                 } );
} );
查看更多
放我归山
3楼-- · 2019-01-10 01:08

If you are using custom filter, you might want to hide search box but still want to enable the filter function, so bFilter: false is not the way. Use dom: 'lrtp' instead, default is 'lfrtip'. Documentation: https://datatables.net/reference/option/dom

查看更多
爷、活的狠高调
4楼-- · 2019-01-10 01:08

if you are using themeroller:

.dataTables_wrapper .fg-toolbar { display: none; }
查看更多
小情绪 Triste *
5楼-- · 2019-01-10 01:09
var table = $("#datatable").DataTable({
   "paging": false,
   "ordering": false,
   "searching": false
});
查看更多
放我归山
6楼-- · 2019-01-10 01:09
hello friends you can add simply searching: false in your js





$('#companies_grid').DataTable({
        responsive: true,
        searching: false,
        iDisplayLength: 25,
        "ajax": base_url + "companies/company_table",
        "columns": [{
                "data": "SRNO"
            },
            {
                "data": "CompanyName"
            },
            {
                "data": "Country"
            },
            {
                "data": "CustomDomain"
            },
            {
                "data": "Email"
            },
            {
                "data": "Edit"
            }
        ]
    });
查看更多
我想做一个坏孩纸
7楼-- · 2019-01-10 01:11

For DataTables >=1.10, use:

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

For DataTables <1.10, use:

$('table').dataTable({bFilter: false, bInfo: false});

or using pure CSS:

.dataTables_filter, .dataTables_info { display: none; }
查看更多
登录 后发表回答