I'm using Chosen in my forms, but I'd like it to ignore the accents when filtering.
For example: In a city listing, filter it correctly to:
- africa
But it does not filter for (as words differ by accent):
- africa
On the project's GitHub, there have been discussions about this since 12/03/2012 ( link ), but have not yet implemented this in the official code.
Reading the existing discussions, I found this working example, posted by @felpasl :
- Example working: link
However, I intend to implement it, but without changing the original source code, to minimize future complications when updating the code from the official repository.
I thought of replacing the method externally, but I can not do it. Below the code I tried, to override the method ...
var Chosen = $('#campo_select_com_chosen').chosen();
Chosen.prototype.search_string_match = function (search_string, regex) {
alert('Método substituído com sucesso');
};
But I get this error:
Uncaught TypeError: Can not set property 'search_string_match' of undefined
My problem is how to replace a method of the lib I'm using without changing its fonts. If it were in PHP I would inherit the class and override the method ... but in JavaScript I do not know how to do it.
Can anyone help me on how to do this implementation, type PlugIn, in Chosen?