1
0
mirror of https://github.com/ansible/awx.git synced 2024-10-28 10:55:30 +03:00

don't toggle the dropdown when removing items from multiselect fields

see: #5466
This commit is contained in:
Ryan Petrello 2017-03-08 11:16:33 -05:00
parent 3679e9b00c
commit 9a6913f184

View File

@ -662,6 +662,20 @@ angular.module('Utilities', ['RestServices', 'Utilities', 'sanitizeFilter'])
$(element).select2(config);
// Don't toggle the dropdown when a multiselect option is
// being removed
if (multiple) {
$(element).on('select2:opening', (e) => {
var unselecting = $(e.target).data('select2-unselecting');
if (unselecting === true) {
$(e.target).removeData('select2-unselecting');
e.preventDefault();
}
}).on('select2:unselecting', (e) => {
$(e.target).data('select2-unselecting', true);
});
}
if (options) {
for (var d = 0; d < $(element + " option").length; d++) {
var item = $(element + " option")[d];