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

前端 未结 19 2658
孤街浪徒
孤街浪徒 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条回答
  •  猫巷女王i
    2020-12-07 08:01

    As of DataTables 1.10.5 it is now possible to define initialisation options using HTML5 data-* attributes.

    -dataTables documentation: HTML5 data-* attributes - table options

    So you can specify data-searching="false" data-paging="false" data-info="false" on the table. For example, this table will not allow searching, apply paging, or show the information block:

    
            ...[ETC]...
        
    Name Avatar Start date Salary
    Tiger Nixon 2011/04/25 $320,800
    Garrett Winters 2011/07/25 $170,750

    See a working example at https://jsfiddle.net/jhfrench/17v94f2s/.

    The advantage to this approach is that it allows you to have a standard dataTables call (ie, $('table.apply_dataTables').DataTable()) while being able to configure the dataTables options table-by-table.

提交回复
热议问题