问题描述
尝试只显示与在搜索栏中输入的搜索词完全匹配的内容.
Trying to only display exact matches to the search term entered in the search bar.
例如,我有一个按 ID# 过滤的搜索栏.我只想显示与输入的确切 # 匹配的记录.
For instance, I have a search bar that filters by ID#. I want only records that match the exact # entered to display.
因此,如果输入了 123
,我不希望显示 12345
、91239
等.只有123
.
So if 123
is entered, I don't want 12345
, 91239
, etc etc to be displayed. Only 123
.
在常见问题页面上看到了一些关于 bRegex
的信息,但它对我不起作用.有什么想法吗?
Saw some info about bRegex
on the FAQ page, but it's not working for me. Any ideas?
推荐答案
好的解决了问题.但是,由于我使用精确匹配的列有时包含多个以逗号分隔的 ID #,因此我将无法使用精确匹配搜索.
Ok solved the problem. However, since the column I am using the exact match on sometimes contains multiple ID #s seperated by commas, I wont be able to use an exact match search.
但对于那些感兴趣的人,这里是答案:
But for those interested, here is the answer:
oTable.fnFilter( "^"+TERM+"$", COLUMN , true); //Term, Column #, RegExp Filter
这篇关于jQuery DataTables - 按完全匹配过滤列的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!