我正在使用jQuery数据表。

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


当前回答

你也可以不画页眉或页脚通过设置sDom: http://datatables.net/usage/options#sDom

'sDom': 't' 

将只显示表,没有页眉或页脚或任何东西。

这里有一些讨论:http://www.datatables.net/forums/discussion/2722/how-to-hide-empty-header-and-footer/p1

其他回答

如果你正在使用themeroller:

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

我通过为footer分配一个id,然后使用css进行样式化来做到这一点:

    <table border="1" class="dataTable" id="dataTable_${dtoItem.key}" >
     <thead>
        <tr>
            <th></th>

        </tr>
    </thead>
 <tfoot>
    <tr>
            <th id="FooterHidden"></th>
    </tr>
</tfoot>
<tbody>

    <tr>

                <td class="copyableField"></td>

    </tr>
 </tbody>
</table>

然后使用CSS样式:

#FooterHidden{
   display: none;
}

如上所述的方法并不适合我。

<script>
$(document).ready(function() {
    $('#nametable').DataTable({
        "bPaginate": false,
        "bFilter": false,
        "bInfo": false
    });
});
</script>

在数据表构造函数中

https://datatables.net/forums/discussion/20006/how-to-remove-cross-icon-in-search-box

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

    /* Results in:
        {length}
        {processing}
        {table}
        {information}
        {pagination}
    */
    $('#example').dataTable( {
      "dom": 'lrtip'
    } );
$('#my_table').DataTable({
   "iDisplayLength": 100,
   "searching": false, 
   "paging": false,
   "info": false,
});