datatables smartsearch v no smart search v regex

喜你入骨 提交于 2020-02-04 10:58:57

问题


Given this datatable example with the option of regex, smartserach or none of the the two(regex, smartserach) what does smart search do?

For instance under column Name:
typing Ai in the search returns 4 entries with or without smart search ticked. Can anyone provide an example where I can see the difference in smart search ticked or not?

For instance under column Name:
typing ^[A] will return 3 entries with regex ticked. ticking smart search or not does not seem to make a difference in this example. Again, can anyone provide an example where I can see the difference in smart search ticked or not with regex ticked?


EDIT1

this link is the documentation that might help

from here suggests it might not be good to have smart search and regex enabled: Note that to perform a smart search, DataTables uses regular expressions, so if enable regular expressions using the second parameter to this method, you will likely want to disable smart searching as the two regular expressions might otherwise conflict and cause unexpected results.


回答1:


See search.smart option for more details.

DataTables' built-in filtering is "smart" in that it breaks the user's input into individual words and then matches those words in any position and in any order in the table (rather than simple doing a simple string compare).

In this example typing Junior Author in Position column will find Junior Technical Author position when "smart" mode enabled. With "smart" mode disabled nothing will be found.



来源:https://stackoverflow.com/questions/39988835/datatables-smartsearch-v-no-smart-search-v-regex

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!