仅通过< td>中的文本进行数据搜索标签 [英] databable search by only text inside <td> tag

查看:45
本文介绍了仅通过< td>中的文本进行数据搜索标签的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I am using datatable 1.9 . I am facing problem in searching. My table look something like this

<'table><'td><'div><'span class = inlineEditCategory> category<'/ span><'/ div><'/ td><'/ table>

<'table> <'td> <'div><'span class="inlineEditCategory" >category<'/span><'/div> <'/td> <'/table>

因此,如果我搜索div这样的单词,那么span的所有行都是显示了不应该显示的内容。我发现正在搜索td之间的内容。它们是仅搜索文本部分的任何方式。

So if I search on the word like div, span then all rows are is shown which should not. I figure out that content between td is being searched. Is their any way to search only the text part.

推荐答案

您可以使用 html过滤插件

包含js文件

然后在数据表初始化中使用如下插件:

And the use the plugin like this in your datatable initialization:

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

您也可以使用aoColumn选项来做到这一点:

You can also do this with the aoColumn option like this:

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

有关更多信息,请参见文档

For more info see the documentation

这篇关于仅通过&lt; td&gt;中的文本进行数据搜索标签的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆