Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed select2 ModelAutocompleteType #7196

Merged
merged 1 commit into from
May 17, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ file that was distributed with this source code.
// Select2 v3 data populate.
// NEXT_MAJOR: Remove while dropping v3 support.
if (window.Select2 && (undefined==data.length || 0<data.length)) { // Leave placeholder if no data set
autocompleteInput.select2('data', data);
autocompleteInput.attr('data', data);
}

// remove unneeded autocomplete text input before form submit
Expand Down Expand Up @@ -304,15 +304,17 @@ file that was distributed with this source code.
{% endif %}

// append to Select2
autocompleteInput.select2('data', data).append(data).trigger('change');
autocompleteInput.attr('data', data).append(data).trigger('change');

// manually trigger the `select2:select` event
autocompleteInput.select2('data', data).trigger({
autocompleteInput.attr('data', data).trigger({
type: 'select2:select',
params: {
data: data
}
});

$('#{{ id }}_hidden_inputs_wrap input:hidden').val(data.value);
}
}
});
Expand Down