DataTable searching utf-8 problem
DataTable searching utf-8 problem
cemili
Posts: 4Questions: 1Answers: 0
Hello guys,
I have searched internet and nothing helps When we use non-ascii chars in search-box it doesnt work. Some suggests to change _fnEscapeRegex function in DataTable.js core. Is this the solution to achieve this problem or there are different solution like we overriding default settings?
thanks so much,
regards.
This discussion has been closed.
Answers
Hello again
We have accomplished the request by using regex search option:
"search": {"regex": true}. And from sDom we have hidden the default search filter area and from fnInitComplete we insert custom textbox and bind keyUp event and in this event we call dt.search(strSearch).draw(). Before calling search we replace the specialcase characters with suitable regex expression. For instance, for character 'ı' in a string we replace with '[ıI]'. By doing so, for the special characters filtering becomes caseinsensitive. By default also the datatables filtering is caseinsentive.
Are you able to give me an example showing the issue please?
Allan
For example in our records we have words like 'FIRIN'. In this word 'I' is the uppercase of 'ı' not 'i'. So when we search like 'fı' no result is shown, but for 'fi' we get the results. So we use regex search option by custom textbox. We append this textbox at fnInitComplete. Yet, we have encountered another problem. As we use custom textbox we dont use default searchBox by not mentioning it in sDom(excluding f). And in some pages when we have two tables having same id in the same page but in different div containers and typing letters in the custom textbox, dataTable wrapper doubles itself and default searchBox is emerging. But when the id of the tables are different everything is fine. We use the selectora as '#div1 #table', '#div2 #table', but somehow something happens in the custom filter search(...) method. But when we use selector as '#dvi1 #table1', '#dvi2 table2' there is no problem. We solved this problem by using default searchBox as hidden. We type letters into custom textBox and produce regex results and we give this regex result into the default searchBox's value and then we trigger the keyup event of the default searchBox very jackel workaround I think If there is any other solution we would appriciate so much
regards,
Cemili
That isn't valid HTML I'm afraid. IDs must be unique, regardless of parents.
Allan
Yes I know, it is the right way. but in the project many partial pages are loaded and many tables given same id but they are in different div containers. As I have said if we use default filterbox there is no problem with the same ids. I think its about the search method. Anyway, by triggering keyup of the default filterbox we accomplish the task.
thanks,
Cemili