【问题标题】:databable search by only text inside <td> tag仅通过 <td> 标记内的文本搜索数据表
【发布时间】:2015-05-13 09:27:13
【问题描述】:

我正在使用数据表 1.9 。我在搜索时遇到问题。我的桌子看起来像这样

category '/td> '/table>

因此,如果我搜索 div, span 之类的词,则显示所有不应该显示的行。我发现正在搜索 td 之间的内容。他们是否有任何方式只搜索文本部分。

【问题讨论】:

    标签: datatables


    【解决方案1】:

    您可以使用html filtering plugin

    在包含datatables.js主脚本后包含js文件。

    在你的数据表初始化中使用这样的插件:

    $('#example').dataTable({
          "columnDefs": [
            { type: "html", target: 0 }             
          ]      
    });
    

    您也可以使用 aoColumn 选项来执行此操作,如下所示:

    $('#example').dataTable( {
        "aoColumns": [
          { "sType": "html" },
          ....
        ]
    } );
    

    欲了解更多信息,请参阅documentation

    【讨论】:

      猜你喜欢
      • 2019-10-22
      • 1970-01-01
      • 1970-01-01
      • 2019-06-29
      • 1970-01-01
      • 1970-01-01
      • 2021-04-04
      • 1970-01-01
      • 2010-10-08
      相关资源
      最近更新 更多