From b6a8bac543f2e1e150bf28330dbe056d2145a38a Mon Sep 17 00:00:00 2001 From: Joshua Gould Date: Tue, 7 Jun 2016 11:14:07 -0400 Subject: [PATCH] autocomplete updates --- src/util/util.js | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/src/util/util.js b/src/util/util.js index 37af456..111a2a8 100644 --- a/src/util/util.js +++ b/src/util/util.js @@ -481,10 +481,6 @@ morpheus.Util.autosuggest = function (options) { return false; } - if (ui.item.select) { - ui.item.select(options.$el); - return false; - } if (options.multi) { var terms = morpheus.Util .getAutocompleteTokens( @@ -494,7 +490,8 @@ morpheus.Util.autosuggest = function (options) { selectionStart: options.$el[0].selectionStart }); - var value = ui.item.value; + var field = event.toElement.dataset.autocomplete; + var value = field ? ui.item[field] : ui.item.value; var show = ui.item.show; // replace the current input @@ -535,8 +532,10 @@ morpheus.Util.autosuggest = function (options) { // use html for label instead of default text var instance = options.$el.autocomplete('instance'); instance._renderItem = function (ul, item) { - return $('
  • ').html( - item.render ? item.render() : item.label).appendTo(ul); + return $('
  • ').html(item.label).appendTo(ul); + }; + instance._normalize = function (items) { + return items; }; if (options.suggestWhenEmpty) { -- GitLab