DataTables 选择带有固定列的过滤器

问题描述

所以,我有一个左侧固定列的数据表,但想添加一个类似选择的过滤器,数据表不支持该过滤器。

我创建了选择过滤器,它在没有固定列的情况下工作得很好,因为它从原始表中过滤。问题是当我修复左列时,它不会将过滤器应用到克隆表中

我已经尝试将 'id' 添加到克隆表中,然后也将过滤器应用到其中,但它不起作用

如图所示,它应用的过滤器“外部”应该只显示橙色行,但固定列显示每一行

Fixed column not filtering

这是我的选择

<select id="filtrarTipo" onclick="filTradoTipo(); filTradoTipoC();">
 <option value="" selected disabled>Seleccione</option>
 <option value="">Todas</option>
 <option value="Interna">Interna</option>
 <option value="Externa">Externa</option>
</select>

还有我的 jquery

function filTradoTipo() {
    // Declare variables
    var input,filter,table,tr,td,i,txtValue;
    input = document.getElementById("filtrarTipo");
    filter = input.value.toupperCase();
    table = document.getElementById("dtBecas");
    tr = table.getElementsByTagName("tr");


    // Loop through all table rows,and hide those who don't match the search query
    for (i = 0; i < tr.length; i++) {
      td = tr[i].getElementsByTagName("td")[4];
      if (td) {
        txtValue = td.textContent || td.innerText;
        if (txtValue.toupperCase().indexOf(filter) > -1) {
          tr[i].style.display = "";
        } else {
          tr[i].style.display = "none";
        }
      }
    }
  }

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)