From 2d3c0520c34031cd4e9b0360cd68e3d5657fac53 Mon Sep 17 00:00:00 2001 From: Hypolite Petovan Date: Mon, 16 Dec 2019 03:13:32 -0500 Subject: [PATCH] Add meaningful sorter to ACL autocomplete --- view/templates/acl_selector.tpl | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/view/templates/acl_selector.tpl b/view/templates/acl_selector.tpl index a5929900b3..a9da4f6118 100644 --- a/view/templates/acl_selector.tpl +++ b/view/templates/acl_selector.tpl @@ -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();