Added dropdownParent
`dropdownParent` controls the location of the dropdown when it is automatically added to the DOM. By default, this is the body element but it can be modified based on where the user needs it.
This commit is contained in:
parent
f7d75b62fa
commit
f6625d2347
8
dist/js/select2.amd.full.js
vendored
8
dist/js/select2.amd.full.js
vendored
@ -742,7 +742,7 @@ define('select2/selection/base',[
|
||||
};
|
||||
|
||||
BaseSelection.prototype.destroy = function () {
|
||||
this._detachCloseHandler();
|
||||
this._detachCloseHandler(this.container);
|
||||
};
|
||||
|
||||
BaseSelection.prototype.update = function (data) {
|
||||
@ -2851,6 +2851,8 @@ define('select2/dropdown/attachBody',[
|
||||
|
||||
], function () {
|
||||
function AttachBody (decorated, $element, options) {
|
||||
this.$dropdownParent = options.get('dropdownParent') || document.body;
|
||||
|
||||
decorated.call(this, $element, options);
|
||||
}
|
||||
|
||||
@ -2981,7 +2983,7 @@ define('select2/dropdown/attachBody',[
|
||||
};
|
||||
|
||||
AttachBody.prototype._showDropdown = function (decorated) {
|
||||
this.$dropdownContainer.appendTo(document.body);
|
||||
this.$dropdownContainer.appendTo(this.$dropdownParent);
|
||||
|
||||
this._positionDropdown();
|
||||
};
|
||||
@ -3323,7 +3325,7 @@ define('select2/core',[
|
||||
], function ($, Options, Utils, KEYS) {
|
||||
var Select2 = function ($element, options) {
|
||||
if ($element.data('select2') != null) {
|
||||
$element.select2('destroy');
|
||||
$element.data('select2').destroy();
|
||||
}
|
||||
|
||||
this.$element = $element;
|
||||
|
8
dist/js/select2.amd.js
vendored
8
dist/js/select2.amd.js
vendored
@ -742,7 +742,7 @@ define('select2/selection/base',[
|
||||
};
|
||||
|
||||
BaseSelection.prototype.destroy = function () {
|
||||
this._detachCloseHandler();
|
||||
this._detachCloseHandler(this.container);
|
||||
};
|
||||
|
||||
BaseSelection.prototype.update = function (data) {
|
||||
@ -2851,6 +2851,8 @@ define('select2/dropdown/attachBody',[
|
||||
|
||||
], function () {
|
||||
function AttachBody (decorated, $element, options) {
|
||||
this.$dropdownParent = options.get('dropdownParent') || document.body;
|
||||
|
||||
decorated.call(this, $element, options);
|
||||
}
|
||||
|
||||
@ -2981,7 +2983,7 @@ define('select2/dropdown/attachBody',[
|
||||
};
|
||||
|
||||
AttachBody.prototype._showDropdown = function (decorated) {
|
||||
this.$dropdownContainer.appendTo(document.body);
|
||||
this.$dropdownContainer.appendTo(this.$dropdownParent);
|
||||
|
||||
this._positionDropdown();
|
||||
};
|
||||
@ -3323,7 +3325,7 @@ define('select2/core',[
|
||||
], function ($, Options, Utils, KEYS) {
|
||||
var Select2 = function ($element, options) {
|
||||
if ($element.data('select2') != null) {
|
||||
$element.select2('destroy');
|
||||
$element.data('select2').destroy();
|
||||
}
|
||||
|
||||
this.$element = $element;
|
||||
|
8
dist/js/select2.full.js
vendored
8
dist/js/select2.full.js
vendored
@ -10277,7 +10277,7 @@ define('select2/selection/base',[
|
||||
};
|
||||
|
||||
BaseSelection.prototype.destroy = function () {
|
||||
this._detachCloseHandler();
|
||||
this._detachCloseHandler(this.container);
|
||||
};
|
||||
|
||||
BaseSelection.prototype.update = function (data) {
|
||||
@ -12386,6 +12386,8 @@ define('select2/dropdown/attachBody',[
|
||||
|
||||
], function () {
|
||||
function AttachBody (decorated, $element, options) {
|
||||
this.$dropdownParent = options.get('dropdownParent') || document.body;
|
||||
|
||||
decorated.call(this, $element, options);
|
||||
}
|
||||
|
||||
@ -12516,7 +12518,7 @@ define('select2/dropdown/attachBody',[
|
||||
};
|
||||
|
||||
AttachBody.prototype._showDropdown = function (decorated) {
|
||||
this.$dropdownContainer.appendTo(document.body);
|
||||
this.$dropdownContainer.appendTo(this.$dropdownParent);
|
||||
|
||||
this._positionDropdown();
|
||||
};
|
||||
@ -12858,7 +12860,7 @@ define('select2/core',[
|
||||
], function ($, Options, Utils, KEYS) {
|
||||
var Select2 = function ($element, options) {
|
||||
if ($element.data('select2') != null) {
|
||||
$element.select2('destroy');
|
||||
$element.data('select2').destroy();
|
||||
}
|
||||
|
||||
this.$element = $element;
|
||||
|
6
dist/js/select2.full.min.js
vendored
6
dist/js/select2.full.min.js
vendored
File diff suppressed because one or more lines are too long
8
dist/js/select2.js
vendored
8
dist/js/select2.js
vendored
@ -1170,7 +1170,7 @@ define('select2/selection/base',[
|
||||
};
|
||||
|
||||
BaseSelection.prototype.destroy = function () {
|
||||
this._detachCloseHandler();
|
||||
this._detachCloseHandler(this.container);
|
||||
};
|
||||
|
||||
BaseSelection.prototype.update = function (data) {
|
||||
@ -3279,6 +3279,8 @@ define('select2/dropdown/attachBody',[
|
||||
|
||||
], function () {
|
||||
function AttachBody (decorated, $element, options) {
|
||||
this.$dropdownParent = options.get('dropdownParent') || document.body;
|
||||
|
||||
decorated.call(this, $element, options);
|
||||
}
|
||||
|
||||
@ -3409,7 +3411,7 @@ define('select2/dropdown/attachBody',[
|
||||
};
|
||||
|
||||
AttachBody.prototype._showDropdown = function (decorated) {
|
||||
this.$dropdownContainer.appendTo(document.body);
|
||||
this.$dropdownContainer.appendTo(this.$dropdownParent);
|
||||
|
||||
this._positionDropdown();
|
||||
};
|
||||
@ -3751,7 +3753,7 @@ define('select2/core',[
|
||||
], function ($, Options, Utils, KEYS) {
|
||||
var Select2 = function ($element, options) {
|
||||
if ($element.data('select2') != null) {
|
||||
$element.select2('destroy');
|
||||
$element.data('select2').destroy();
|
||||
}
|
||||
|
||||
this.$element = $element;
|
||||
|
4
dist/js/select2.min.js
vendored
4
dist/js/select2.min.js
vendored
File diff suppressed because one or more lines are too long
@ -467,7 +467,7 @@ ajax: {
|
||||
<dd><code>dropdownParent</code></dd>
|
||||
|
||||
<dt>Value</dt>
|
||||
<dd>jQuery element</dd>
|
||||
<dd>jQuery element or DOM node</dd>
|
||||
|
||||
<hr />
|
||||
|
||||
|
2
src/js/select2/core.js
vendored
2
src/js/select2/core.js
vendored
@ -6,7 +6,7 @@ define([
|
||||
], function ($, Options, Utils, KEYS) {
|
||||
var Select2 = function ($element, options) {
|
||||
if ($element.data('select2') != null) {
|
||||
$element.select2('destroy');
|
||||
$element.data('select2').destroy();
|
||||
}
|
||||
|
||||
this.$element = $element;
|
||||
|
4
src/js/select2/dropdown/attachBody.js
vendored
4
src/js/select2/dropdown/attachBody.js
vendored
@ -2,6 +2,8 @@ define([
|
||||
|
||||
], function () {
|
||||
function AttachBody (decorated, $element, options) {
|
||||
this.$dropdownParent = options.get('dropdownParent') || document.body;
|
||||
|
||||
decorated.call(this, $element, options);
|
||||
}
|
||||
|
||||
@ -132,7 +134,7 @@ define([
|
||||
};
|
||||
|
||||
AttachBody.prototype._showDropdown = function (decorated) {
|
||||
this.$dropdownContainer.appendTo(document.body);
|
||||
this.$dropdownContainer.appendTo(this.$dropdownParent);
|
||||
|
||||
this._positionDropdown();
|
||||
};
|
||||
|
2
src/js/select2/selection/base.js
vendored
2
src/js/select2/selection/base.js
vendored
@ -98,7 +98,7 @@ define([
|
||||
};
|
||||
|
||||
BaseSelection.prototype.destroy = function () {
|
||||
this._detachCloseHandler();
|
||||
this._detachCloseHandler(this.container);
|
||||
};
|
||||
|
||||
BaseSelection.prototype.update = function (data) {
|
||||
|
Loading…
Reference in New Issue
Block a user