jQuery-Autocomplete icon indicating copy to clipboard operation
jQuery-Autocomplete copied to clipboard

Hoist exact matches to top of autocomplete suggestions

Open user24 opened this issue 9 years ago • 2 comments

For query "Bee", with data:

var suggestions = [{
    "value": "beetle"
},{
    "value": "beezlebub"
},{
    "value": "bee"
},{
    "value": "beet"
}]

Used to suggest:

beetle
beezlebub
bee
beet

now suggests:

bee
beetle
beezlebub
beet

Could be improved further but it's better than no sorting.

user24 avatar May 30 '16 22:05 user24

Would actually be better to allow people to supply their own sort function, with something like this as the default, imho.

user24 avatar May 30 '16 22:05 user24

You can actually provide your own lookup function where you can filter and sort results anyway you want.

Also it would make sense that sort function can be provided via options and optional.

tkirda avatar Jun 02 '16 03:06 tkirda