【问题标题】:How to combine datatable search box and tableTools buttons in one row如何将数据表搜索框和tableTools按钮组合在一行中
【发布时间】:2014-11-27 06:43:09
【问题描述】:

我正在使用以下示例使用数据表 tableTools 多行选择(全选/取消全选)。

http://datatables.net/release-datatables/extensions/TableTools/examples/select_multi.html

我只想在一行中组合搜索框和选择/取消选择所有按钮。目前全选/取消全选在一行,搜索框在另一行,占用两行,我想优化空间,使其在单行中。

这是目前的样子:

【问题讨论】:

    标签: jquery datatable


    【解决方案1】:
    <div class="DTTT_container" id="chuji1" ><a class="DTTT_button DTTT_button_text" id="ToolTables_example_0" tabindex="0" aria-controls="example"><span>Select all</span></a><a class="DTTT_button DTTT_button_text DTTT_disabled" id="ToolTables_example_1" tabindex="0" aria-controls="example"><span>Deselect all</span></a></div>
    
    <div id="example_filter" class="dataTables_filter"><label>Search:<input type="search" class="" placeholder="" aria-controls="example"></label></div>![enter image description here][1]
    
    
    step 1: put these two css classes in library
    
    .cssforchuji1{position: absolute;padding-left: 804px;padding-top:5px;}
    .cssforchuji2{padding-right: 243px;}
    
    step 2: put this code in js
    
    $(document).ready(function() {
        $("#chuji1").addClass('cssforchuji1');
        $("#example_filter").addClass('cssforchuji2');
    }
    

    【讨论】:

    • 谢谢!它工作得很好。但是必须在 position:absolute 前面使用 !important,因为 position:relative 已经在 TableTools css 中定义
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-07-16
    • 1970-01-01
    • 2021-12-03
    • 2014-05-10
    • 1970-01-01
    相关资源
    最近更新 更多