How can I remove the search bar and footer added by the jQuery DataTables plugin?

前端 未结 19 2607
孤街浪徒
孤街浪徒 2020-12-07 07:45

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 wan

相关标签:
19条回答
  • 2020-12-07 08:05

    You can also not draw the header or footer at all by setting sDom: http://datatables.net/usage/options#sDom

    'sDom': 't' 
    

    will display JUST the table, no headers or footers or anything.

    It's discussed some here: http://www.datatables.net/forums/discussion/2722/how-to-hide-empty-header-and-footer/p1

    0 讨论(0)
  • 2020-12-07 08:05

    if you are using themeroller:

    .dataTables_wrapper .fg-toolbar { display: none; }
    
    0 讨论(0)
  • 2020-12-07 08:08

    Here you can add to sDom element to your code, top search bar is hidden.

    $(document).ready(function() {
        $('#example').dataTable( {
    "sDom": '<"top">rt<"bottom"flp><"clear">'
     } );
    } );
    
    0 讨论(0)
  • 2020-12-07 08:08

    If you only want to hide the search form for example because you have column input filters or may be because you already have a CMS search form able to return results from the table then all you have to do is inspect the form and get its id - (at the time of writing this, it looks as such[tableid]-table_filter.dataTables_filter). Then simply do [tableid]-table_filter.dataTables_filter{display:none;} retaining all other features of datatables.

    0 讨论(0)
  • 2020-12-07 08:09

    You can use sDom attribute. Code looks something like this.

    $(document).ready(function() {
        $('#example').dataTable( {
            'sDom': '"top"i'
                     } );
    } );
    

    İt hides search and pager box.

    0 讨论(0)
  • 2020-12-07 08:10

    A quick and dirty way is to find out the class of the footer and hide it using jQuery or CSS:

    $(".dataTables_info").hide();
    
    0 讨论(0)
提交回复
热议问题