Properly assign dropdownParent in Select2 controls. Fixes #4218

This commit is contained in:
Neel Patel
2019-04-30 12:57:17 +01:00
committed by Dave Page
parent 277bf85645
commit 34b59da526
3 changed files with 25 additions and 7 deletions

View File

@@ -2017,13 +2017,6 @@ define([
if (!data.visible)
this.$el.addClass(Backform.hiddenClassName);
// Dropdown body can be render at user given location
// If isDropdownParent flag is set to true then, By default we will
// display it on the control itself.
if (data.select2.isDropdownParent) {
select2Opts.dropdownParent = data.select2.dropdownParent || this.$el;
}
this.$el.html(this.template(data)).addClass(field.name);
var select2Opts = _.extend({
@@ -2032,6 +2025,13 @@ define([
options: (this.field.get('options') || this.defaults.options),
});
// Dropdown body can be render at user given location
// If isDropdownParent flag is set to true then, By default we will
// display it on the control itself.
if (data.select2.isDropdownParent) {
select2Opts.dropdownParent = data.select2.dropdownParent || this.$el;
}
// If disabled then no need to show placeholder
if (data.disabled || data.mode === 'properties') {
select2Opts['placeholder'] = '';