I am working on JQueryUI autocomplete and would like a slightly different behavior than the default. I have an array of strings:
var json = ["Atlanta", "Chicago", "Little Rock", "RockFord", "Rhode Island"];
I would like the following results when I input the following to autocomplete.
Type: "R"
Actual Result:
Little Rock
Rhode Island
RockFord
Expected Result:
Rhode Island
RockFord
Little Rock
Type: Rock
Actual Result:
Little Rock
RockFord
Expected Result:
RockFord
Little Rock
Here's my jsFiddle
I would like the results to be ordered alphabetically first followed by matches in other words. I looked at this link but that only gets me the alphabetical ordering. When I type in "Rock" I would get only RockFord.
Any ideas?