1
0
Fork 0

Merge pull request #7959 from MrPetovan/bug/7902-acl-fixes

Add meaningful sorter to ACL autocomplete
This commit is contained in:
Tobias Diekershoff 2019-12-16 11:34:28 +01:00 committed by GitHub
commit 50f5e4e7ed
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -145,6 +145,15 @@
identify: function(obj) { return obj.type + '-' + obj.id.toString(); },
datumTokenizer: Bloodhound.tokenizers.obj.whitespace(['name', 'addr']),
queryTokenizer: Bloodhound.tokenizers.whitespace,
sorter: function (itemA, itemB) {
if (itemA.name === itemB.name) {
return 0;
} else if (itemA.name > itemB.name) {
return 1;
} else {
return -1;
}
},
});
acl.initialize();