【问题标题】:Datatables filtering数据表过滤
【发布时间】:2016-03-11 07:23:23
【问题描述】:

我在使用数据表的过滤功能时遇到了困难。我使用版本 1.10。这是我尝试过的:

$("#hide").click(function() {
    $.fn.dataTable.ext.search.push(
       function(settings, data, dataIndex) {
          return $(table.row(dataIndex).node()).attr('data-user') == 5;
       }
    );
    table.draw();
});    
$("#reset").click(function() {
    $.fn.dataTable.ext.search.pop();
    table.draw();
});

但是表格没有更新。有什么我可能做错了吗?当我执行 console.log 时,有问题的数组似乎正在更新,但没有迹象表明该函数被调用。

非常感谢!

【问题讨论】:

    标签: jquery datatables


    【解决方案1】:

    过滤数据表。 循环遍历数据表中的所有行

    $("#Datatable").html().find("xxx").hide();
    or 
    $('#Datatable tr').each(function(index,value) {
    if( $(this).find('xxx'))
       {
          $(this).hide();
       }
    });
    

    提供更多重新分级功能的细节。

    【讨论】:

    • 这是我目前正在做的,但是隐藏后分页没有更新
    猜你喜欢
    • 2019-11-15
    • 1970-01-01
    • 2014-03-01
    • 2015-11-20
    • 2013-08-29
    • 2013-01-03
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多