Skip to content

Commit

Permalink
Merge pull request #300 from surveyjs/feature/299
Browse files Browse the repository at this point in the history
Resolve for #299: add preferred method of sort in autocomplete widget
  • Loading branch information
OlgaLarina authored Mar 30, 2022
2 parents 79bae0b + 7ca5c29 commit 7fa5df9
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/easy-autocomplete.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,12 @@ function init(Survey, $) {
options.list = {
sort: {
enabled: true,
method: (aStr, bStr) => {
const inputStr = $el.val().toLowerCase();
const aIndex = aStr.toLowerCase().indexOf(inputStr);
const bIndex = bStr.toLowerCase().indexOf(inputStr);
return aIndex - bIndex;
}
},
match: {
enabled: true,
Expand Down

0 comments on commit 7fa5df9

Please sign in to comment.