Add meaningful sorter to ACL autocomplete
This commit is contained in:
parent
dbc47da750
commit
2d3c0520c3
1 changed files with 9 additions and 0 deletions
|
@ -145,6 +145,15 @@
|
||||||
identify: function(obj) { return obj.type + '-' + obj.id.toString(); },
|
identify: function(obj) { return obj.type + '-' + obj.id.toString(); },
|
||||||
datumTokenizer: Bloodhound.tokenizers.obj.whitespace(['name', 'addr']),
|
datumTokenizer: Bloodhound.tokenizers.obj.whitespace(['name', 'addr']),
|
||||||
queryTokenizer: Bloodhound.tokenizers.whitespace,
|
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();
|
acl.initialize();
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue