diff --git a/awx/ui/client/src/shared/Utilities.js b/awx/ui/client/src/shared/Utilities.js index d8233a316c..d51045be78 100644 --- a/awx/ui/client/src/shared/Utilities.js +++ b/awx/ui/client/src/shared/Utilities.js @@ -695,25 +695,26 @@ angular.module('Utilities', ['RestServices', 'Utilities', 'sanitizeFilter']) options = params.opts; $.fn.select2.amd.require([ - "select2/utils", - "select2/dropdown", - "select2/dropdown/attachContainer", - "select2/dropdown/search", - ], function (Utils, DropdownAdapter, AttachContainer, DropdownSearch) { + 'select2/utils', + 'select2/dropdown', + 'select2/dropdown/search', + 'select2/dropdown/attachContainer', + 'select2/dropdown/closeOnSelect', + 'select2/dropdown/minimumResultsForSearch' + ], function (Utils, Dropdown, Search, AttachContainer, CloseOnSelect, MinimumResultsForSearch) { - var CustomAdapter = Utils.Decorate( - Utils.Decorate( - DropdownAdapter, - DropdownSearch - ), - AttachContainer - ); + var CustomAdapter = + _.reduce([Search, AttachContainer, CloseOnSelect, MinimumResultsForSearch], + function(Adapter, Decorator) { + return Utils.Decorate(Adapter, Decorator); + }, Dropdown); $(element).select2({ - dropdownAdapter: CustomAdapter, multiple: 'true', theme: "bootstrap", - width: '100%' + width: '100%', + minimumResultsForSearch: Infinity, + dropdownAdapter: CustomAdapter }); if(options){ for (var d = 0; d < $(element + " option").length; d++) { diff --git a/awx/ui/client/src/shared/form-generator.js b/awx/ui/client/src/shared/form-generator.js index 9c2a9aea69..f0709c63fa 100644 --- a/awx/ui/client/src/shared/form-generator.js +++ b/awx/ui/client/src/shared/form-generator.js @@ -1117,15 +1117,18 @@ angular.module('FormGenerator', [GeneratorHelpers.name, 'Utilities', listGenerat html += buildId(field, fld, this.form); html += (options.mode === 'edit' && field.editRequired) ? "required " : ""; html += (options.mode === 'add' && field.addRequired) ? "required " : ""; + //used for select2 combo boxes html += (field.multiSelect) ? "multiple " : ""; html += (field.readonly) ? "disabled " : ""; html += (field.awRequiredWhen) ? "data-awrequired-init=\"" + field.awRequiredWhen.init + "\" aw-required-when=\"" + field.awRequiredWhen.variable + "\" " : ""; html += ">\n"; - html += "\n"; + if(!field.multiSelect){ + html += "\n"; + } html += "\n"; // Add error messages if ((options.mode === 'add' && field.addRequired) || (options.mode === 'edit' && field.editRequired) ||