jQuery DataTable多值搜索

时间:2016-05-03 21:56:15

标签: jquery datatables

我的情况是我在列" Office"中过滤值使用selectbox我可以选择多个值。例如,我想过滤"纽约"和#34;旧金山"在专栏" Office"所以我希望只有第一行,因为它包含两个值。我当前的代码显示第一行和另一行,因为它们包含"纽约"或"旧金山"

Exmple http://live.datatables.net/fadixapi/1/edit?html,js,output

解决
    selected = $("#"+selectId+' option:selected').map(function(){ return "(?=.*"+this.value+")"; }).get(); table.column(2).search("^.*" + search + ".*$",true).draw();

1 个答案:

答案 0 :(得分:1)

试试这个:

table.column(2)
.search("^" + search + "$", column, true, false)
.draw() ;
相关问题