首页 > 解决方案 > 在 jQuery 中显示/隐藏已经通过显示或隐藏“过滤”的表行

问题描述

我有一个由 AZ 选项卡过滤的记录集结果表。因此,当我单击字母“A”时,只有以<tr>字母 A 开头的 's 才会从完整列表中显示出来。一切都很好,现在的问题是它需要进一步过滤。

现在我需要在所有/活动/非活动之间过滤它。我似乎无法弄清楚这一点。如何显示已经隐藏/显示行的隐藏表行?这是我用于字母过滤的代码。

  $('.but_tab').on('click',function(){
    $('.nav-tabs .active').removeClass('active');

    var tab = $(this).attr('data-tab');
    $(this).parent('li').addClass('active');

    console.log(tab);

    $('.t_all').hide();
    $('.t_'+tab).show();

    // further filter list based on whether all/active/inactive has the active class...?
    filterResults();

  });

function filterResults(){

    var curFilter = $('.but-filter.active').attr('data-type');

    //?

};

下面是表格行的代码:

<tr class="t_all t_A filter-all filter-True">

每行将包含“filter-all”和“filter-True”或“filter-False”,具体取决于它是否处于活动状态。

标签: jquerycss

解决方案


推荐阅读