数据过滤器覆盖数据搜索属性

问题描述

使用 DataTables,我目睹了一个可重现的问题,其中 data-filter html 属性的值覆盖了 data-search html 属性的可搜索性。

<td data-search="Jared Next" data-order="Jared Next" data-filter="Full-Time DM">
  <div class="mb-2">
    Jared Next
  </div>
  <div class="mb-2 text-muted small" title="Number of total deals posted by DM">
    Posted: 294
  </div>
</td>

按“jared”搜索时,该行不会出现。

按“全职 dm”搜索时,确实会出现该行。

值得一提的是过滤器按预期工作:

如果我没有提供足够的代码来重现问题,或者如果 DataTables 专家想要整个表格,我深表歉意。

我可以轻松提供一切。

解决方法

data-searchdata-filter 属性在数据表中是同义词。

有关详细信息,请参阅 here

您应该使用其中之一,但不能同时使用两者。

此外,来自与上述相同的文档链接,以防万一:确保对列中的每个单元格使用一致的属性:

为了使 HTML 5 data-* 属性检测和处理正常工作,列中的所有单元格必须具有相同的可用属性。