Search and Top Navigation
#5219 closed feature (fixed)
Opened February 23, 2010 08:29PM UTC
Closed July 20, 2010 01:56AM UTC
Last modified November 19, 2010 06:26PM UTC
Autocomplete: Support for accent-folding
Reported by: | jzaefferer | Owned by: | |
---|---|---|---|
Priority: | major | Milestone: | 1.8.3 |
Component: | ui.autocomplete | Version: | 1.8rc2 |
Keywords: | Cc: | ||
Blocked by: | Blocking: |
Description
Explanation of accent-folding and an example for YUI: http://www.alistapart.com/articles/accent-folding-for-auto-complete/
Autocomplete should support adding accent-folding on top.
Attachments (0)
Change History (7)
Changed April 12, 2010 06:29PM UTC by comment:1
Changed April 15, 2010 02:13AM UTC by comment:2
The if condition is also probably needs tweaking. It currently says:
if (new RegExp(cache.term).test(request.term) && cache.content && cache.content.length < 13) { var matcher = new RegExp($.ui.autocomplete.escapeRegex(request.term), "i"); response($.grep(cache.content, function(value) { return matcher.test(value.value) })); }
It should be:
if (new RegExp($.ui.autocomplete.escapeRegex(cache.term)).test(request.term) && cache.content && cache.content.length < 13) { var matcher = new RegExp($.ui.autocomplete.escapeRegex(request.term), "i"); response($.grep(cache.content, function(value) { return matcher.test(value.value); })); return; }
Note that cache.term in the if condition is now wrapped in a call to $.ui.autocomplete.escapeRegex to match the matcher RegExp. Also the original bug is fixed by adding a return to the if block.
Also matcher tests value.value, this is a deviation from how the list of object works in the autocomplete itself. It uses:
return matcher.test( value.label || value.value || value );
Changed April 15, 2010 02:14AM UTC by comment:3
Wrong bug for that last comment.
Changed April 21, 2010 02:08PM UTC by comment:4
Added a demo in /demos/autocomplete/folding.html in 6a59746d1d97cb24bafe50c1434d9398be9c7585.
Changed July 20, 2010 01:56AM UTC by comment:5
milestone: | 1.next → 1.9 |
---|---|
resolution: | → fixed |
status: | new → closed |
Added a link to the demo in 5debdb0. I also built an extension that can be loaded after the plugin to automatically support accent folding when using arrays as the source; it's available in my jQuery UI Extensions repo (source, demo).
Changed August 04, 2010 01:21AM UTC by comment:6
milestone: | 1.9 → 1.8.3 |
---|
It does. I'm doing it.
You want your source to be a function. See the "Combo Box" example for highlighting and the "Remote With Caching" for searching through an object list for values to display. You just need to change the match and highlight to be accent insensitive.