在我的网站,我使用插件 wpDataTables ,基于 jQuery DataTables 。
On my site I am using the plugin wpDataTables based on jQuery DataTables.
价目表中第一列包含值 - AUR , D , DH 等等。表被编程为仅显示许多的前6个结果。
My first column in the price list table contains values - AUR, D, DH, etc. Table is programmed to show only first 6 results out of many.
这是问题:如果我希望用户在搜索字段 D 中找到值 D 和用户类型,您将得到一个列表中的值 DH 。
Here is the problem: If I want user to find value D and user types in the search field D, you'll get a list with values DH.
这是因为默认情况下,jQuery DataTables插件查找包含值 D (例如 DH 等),但我希望它执行完全匹配。
It happens because by default jQuery DataTables plugin finds records that contain value D (such as DH, etc), but I want it to perform exact match.
请参阅 Excel电子表格,其中包含所有记录作为参考。
Please see Excel spreadsheet containing all records for reference.
推荐答案您需要遵循此文档,最终得到以下内容:
You need to follow this documentation and end up with something like this:
table.column( 1 ).search( '^My exact match$', true, false );您可以在传递到搜索功能之前输入或添加引号时使用引号:
You can also use quotes when you input or add them before passing to the search function:
table.search( '"My exact match"' );文档: datatables/reference/api/column().search()
更多推荐
搜索时执行完全匹配
发布评论