dataTables(jquery)按两列搜索

问题描述:

我只想按两列搜索表.例如.初始搜索在所有列中进行搜索,我只想按两列进行搜索. 当我使用以下代码时:

I want to search table by only two columns. E.g. Initial search searches in all columns, I just want to search by two columns. When I use following code:

dataTable.columns([1,7])
    .search("some string")
    .draw(); 

搜索文字必须同时出现在两列中才能显示.我想显示它,即使它存在于其中一列中.有人可以帮忙吗?

the search text must be present in both columns to be displayed. I want to display it even if it exists in one of the columns. Can anyone help?

谢谢

已解决

我已将搜索更改为搜索所有列的首字母:

I've changed searching to initial which searches all columns:

dataTable
    .search(this.value)
    .draw();

并在initTable中设置不想搜索的列:

And set columns which I don't want to be search in initTable:

    "columnDefs": [
    {
        "targets": [2,5],
        "searchable": false
    }]