Accent neutralise search & localeCompare sorting
Accent neutralise search & localeCompare sorting
Hello guys,
i need use sorting table and search with Czech characters like Ě,Š,Č,Ř,Ž etc. I want use localeCompare for sorting and Accent neutralise in the same time for search. Its possible use it both? I cant find solution :-/
localeCompare without Accent neutralise works fine... Accent neutralise without localeCompare it also works, but both in same time not working. Have someone better solution for this?
Here is example:
jsfiddle.net/rc4wxnc7/9/
This question has accepted answers - jump to:
Answers
Took me a few minutes to figure out what was going on there, but the issue was that the plug-ins were being attached to two different column
types
(locale-compare
for the sort andstring
for the filter). A column can only have one type, so we need to use the same for both plug-ins.Adjusting the name of the filtering plug-in allows it to work as expected: https://jsfiddle.net/rc4wxnc7/10/ .
Regards,
Allan
Hi Allan,
thanks for reply and solution :-) But not working properly. When write to search form "ada" the script show "Áda" row... and now comes problem. When write to search "Áda" so page doesn't show row with "Áda". Have solution for this?
Regards,
Mertak
You're removing the accent from the data you're comparing against, but you're not from the filter.
Do both to get the expected result:
https://jsfiddle.net/ep7d6as0/
Omg I tested the same solution but I had a little mistake in it Thanks HPB and allan
This still does a double search on the datatable if a character with an accent is entered in the filter box.
For reference purposes I'd like to propose a cleaner solution.
In this fiddle I removed the default behaviour and added a change listener with expected behaviour.
https://jsfiddle.net/d9vtu79g/
I use little diferent script like you, but your script looks better than my Thx HPB for big help :-)
Hello all (sorry first for my english..)
I have 2 questions about the last answer of HPB https://jsfiddle.net/d9vtu79g/ :
* The cross allowing to delete the global search field does not work anymore ?
* I don't get how to know what is the name to set for the selector name in the example $('#example_filter input') ? In the Accent Neutraliser plugin example, the selector name was $('#myInput')... It is not clear for me..
thank you
hello,
The solution (https://jsfiddle.net/d9vtu79g/ works very well.
I have a stupid problem.
I can not integrate it with my script : " $('.datatable-basic').DataTable({
"order": [[ 0, "desc" ]],
"columnDefs":
[{"targets": [ 0 ],
"visible": true, ...
Thank you very much for your help.
Chris