DataTables - Case Sensitive Doesn't Work for Some Characters
DataTables - Case Sensitive Doesn't Work for Some Characters
ocelikdemir
Posts: 2Questions: 1Answers: 0
jQuery DataTables doesn't work for some local characters like uppercase "İ" and lowercase "ı". I tried case sensitive setting for "search" function but nothing changed.
I have created the following fiddle. Could you please check what I am doing wrong?
jsFiddle - Case Sensitive Issue
This question has an accepted answers - jump to answer
Answers
Rather curoious this. Just plain Javascript in the console:
Looks good. However:
If I print out the character code from each string we can see why that is:
Even using
toLocaleLowerCase
makes no difference.I think the closest we can get to supporting this is with this plug-in. Here is an updated example with it.
The downside is that you can't filter on a string which mixes non-ASCII characters and not. You either need to search with ASCII characters, which will match, or with the exact non-ASCII characters, which would also match. However
Çelikdemir
would not match since it is a mix of the two.Allan
Dear Allan,
I found out another way. I know, it's not good way but it works. I have converted input field value as well as table values to uppercase on the fly. I modified the DataTables search function as below:
Github - Search Function
Nice one - thanks for sharing that. This might be a really useful thing to include in the core, in a locale specific way, so I'll look into it further.
Allan