本文介绍了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
}]
这篇关于dataTables(jquery)按两列搜索的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!