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

Merge pull request #5663 from ryanpetrello/fix-5466

don't toggle the dropdown when removing items from multiselect fields
This commit is contained in:
Ryan Petrello 2017-03-09 10:25:18 -05:00 committed by GitHub
commit 3a95c34a04

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];