Actions
Anomalie #473
closedMake autocompletion works with accents
Start date:
04/24/2015
Due date:
% Done:
100%
Estimated time:
(Total: 2.00 h)
Resolution:
Description
It seems textboxList is no longer maintained and does not support accents :
https://github.com/rauchg/TextboxList/issues/18
Consider swicthing to an alternative :
Updated by Simon over 10 years ago
Updated by Simon over 10 years ago
Implementing https://select2.github.io/ to autocomplete will also replace multiselect library since it also covers this feature
Updated by Simon over 10 years ago
https://select2.github.io/ relies on select box, so it won't let user enter values if javascript is disabled. Don't like this idea
https://github.com/devbridge/jQuery-Autocomplete should be a good alternative
Updated by Simon over 10 years ago
- Status changed from Nouveau to Fermé
- % Done changed from 0 to 100
Applied in changeset linea21|r2803.
Updated by Simon over 10 years ago
Solution came from here :
http://stackoverflow.com/questions/2127124/utf-8-problem-in-using-jquery-autocomplete-tags
$.TextboxList.Autocomplete.Methods = {
standard: {
filter: function(values, search, insensitive, max){
var newvals = [];
// fix @simo
// regexp = new RegExp('\\b' + escapeRegExp(search), insensitive ? 'i' : '');
// http://stackoverflow.com/questions/2127124/utf-8-problem-in-using-jquery-autocomplete-tags
regexp = new RegExp('' + escapeRegExp(search), insensitive ? 'i' : '');
for (var i = 0; i < values.length; i++){
if (newvals.length === max) break;
if (regexp.test(values[i][1])) newvals.push(values[i]);
}
return newvals;
},
highlight: function(element, search, insensitive, klass){
// var regex = new RegExp('(<[^>]*>)|(\\b'+ escapeRegExp(search) +')', insensitive ? 'ig' : 'g');
var regex = new RegExp('(<[^>]*>)|('+ escapeRegExp(search) +')', insensitive ? 'ig' : 'g');
return element.html(element.html().replace(regex, function(a, b, c){
return (a.charAt(0) == '<') ? a : '<strong class="'+ klass +'">' + c + '</strong>';
}));
}
}
};
Actions