Move positioning into the components
The main container should not need to position the individual components. This makes it easier for components to override where they should be placed, such as adding the dropdown outside of the container.
This commit is contained in:
parent
be3414f6fe
commit
31c09315c8
46
dist/js/select2.amd.full.js
vendored
46
dist/js/select2.amd.full.js
vendored
@ -230,6 +230,11 @@ define('select2/results',[
|
|||||||
this.$results.append($options);
|
this.$results.append($options);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Results.prototype.position = function ($results, $container) {
|
||||||
|
var $resultsContainer = $container.find('.select2-results');
|
||||||
|
$resultsContainer.append($results);
|
||||||
|
};
|
||||||
|
|
||||||
Results.prototype.sort = function (data) {
|
Results.prototype.sort = function (data) {
|
||||||
return data;
|
return data;
|
||||||
};
|
};
|
||||||
@ -724,6 +729,11 @@ define('select2/selection/base',[
|
|||||||
$(document.body).off('mousedown.select2.' + container.id);
|
$(document.body).off('mousedown.select2.' + container.id);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
BaseSelection.prototype.position = function ($selection, $container) {
|
||||||
|
var $selectionContainer = $container.find('.selection');
|
||||||
|
$selectionContainer.append($selection);
|
||||||
|
};
|
||||||
|
|
||||||
BaseSelection.prototype.destroy = function () {
|
BaseSelection.prototype.destroy = function () {
|
||||||
// Unbind the dropdown click handler if it exists
|
// Unbind the dropdown click handler if it exists
|
||||||
$(document.body).off('.select2.' + this.container.id);
|
$(document.body).off('.select2.' + this.container.id);
|
||||||
@ -2575,6 +2585,11 @@ define('select2/dropdown',[
|
|||||||
return $dropdown;
|
return $dropdown;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Dropdown.prototype.position = function ($dropdown, $container) {
|
||||||
|
var $dropdownContainer = $container.find('.dropdown-wrapper');
|
||||||
|
$dropdownContainer.append($dropdown);
|
||||||
|
};
|
||||||
|
|
||||||
Dropdown.prototype.destroy = function () {
|
Dropdown.prototype.destroy = function () {
|
||||||
// Remove the dropdown from the DOM
|
// Remove the dropdown from the DOM
|
||||||
this.$dropdown.remove();
|
this.$dropdown.remove();
|
||||||
@ -3135,24 +3150,22 @@ define('select2/core',[
|
|||||||
|
|
||||||
var SelectionAdapter = this.options.get('selectionAdapter');
|
var SelectionAdapter = this.options.get('selectionAdapter');
|
||||||
this.selection = new SelectionAdapter($element, this.options);
|
this.selection = new SelectionAdapter($element, this.options);
|
||||||
|
this.$selection = this.selection.render();
|
||||||
|
|
||||||
var $selection = this.selection.render();
|
this.selection.position(this.$selection, $container);
|
||||||
|
|
||||||
this._placeSelection($selection);
|
|
||||||
|
|
||||||
var DropdownAdapter = this.options.get('dropdownAdapter');
|
var DropdownAdapter = this.options.get('dropdownAdapter');
|
||||||
this.dropdown = new DropdownAdapter($element, this.options);
|
this.dropdown = new DropdownAdapter($element, this.options);
|
||||||
|
this.$dropdown = this.dropdown.render();
|
||||||
|
|
||||||
var $dropdown = this.dropdown.render();
|
this.dropdown.position(this.$dropdown, $container);
|
||||||
|
|
||||||
this._placeDropdown($dropdown);
|
|
||||||
|
|
||||||
var ResultsAdapter = this.options.get('resultsAdapter');
|
var ResultsAdapter = this.options.get('resultsAdapter');
|
||||||
this.results = new ResultsAdapter($element, this.options, this.data);
|
this.results = new ResultsAdapter($element, this.options, this.data);
|
||||||
|
|
||||||
var $results = this.results.render();
|
this.$results = this.results.render();
|
||||||
|
|
||||||
this._placeResults($results);
|
this.results.position(this.$results, $container);
|
||||||
|
|
||||||
// Bind events
|
// Bind events
|
||||||
|
|
||||||
@ -3213,23 +3226,6 @@ define('select2/core',[
|
|||||||
$container.width(this.$element.outerWidth(false));
|
$container.width(this.$element.outerWidth(false));
|
||||||
};
|
};
|
||||||
|
|
||||||
Select2.prototype._placeSelection = function ($selection) {
|
|
||||||
var $selectionContainer = this.$container.find('.selection');
|
|
||||||
$selectionContainer.append($selection);
|
|
||||||
};
|
|
||||||
|
|
||||||
Select2.prototype._placeDropdown = function ($dropdown) {
|
|
||||||
this.$dropdown = $dropdown;
|
|
||||||
|
|
||||||
var $dropdownContainer = this.$container.find('.dropdown-wrapper');
|
|
||||||
$dropdownContainer.append($dropdown);
|
|
||||||
};
|
|
||||||
|
|
||||||
Select2.prototype._placeResults = function ($results) {
|
|
||||||
var $resultsContainer = this.$dropdown.find('.select2-results');
|
|
||||||
$resultsContainer.append($results);
|
|
||||||
};
|
|
||||||
|
|
||||||
Select2.prototype._bindAdapters = function () {
|
Select2.prototype._bindAdapters = function () {
|
||||||
this.data.bind(this, this.$container);
|
this.data.bind(this, this.$container);
|
||||||
this.selection.bind(this, this.$container);
|
this.selection.bind(this, this.$container);
|
||||||
|
46
dist/js/select2.amd.js
vendored
46
dist/js/select2.amd.js
vendored
@ -230,6 +230,11 @@ define('select2/results',[
|
|||||||
this.$results.append($options);
|
this.$results.append($options);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Results.prototype.position = function ($results, $container) {
|
||||||
|
var $resultsContainer = $container.find('.select2-results');
|
||||||
|
$resultsContainer.append($results);
|
||||||
|
};
|
||||||
|
|
||||||
Results.prototype.sort = function (data) {
|
Results.prototype.sort = function (data) {
|
||||||
return data;
|
return data;
|
||||||
};
|
};
|
||||||
@ -724,6 +729,11 @@ define('select2/selection/base',[
|
|||||||
$(document.body).off('mousedown.select2.' + container.id);
|
$(document.body).off('mousedown.select2.' + container.id);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
BaseSelection.prototype.position = function ($selection, $container) {
|
||||||
|
var $selectionContainer = $container.find('.selection');
|
||||||
|
$selectionContainer.append($selection);
|
||||||
|
};
|
||||||
|
|
||||||
BaseSelection.prototype.destroy = function () {
|
BaseSelection.prototype.destroy = function () {
|
||||||
// Unbind the dropdown click handler if it exists
|
// Unbind the dropdown click handler if it exists
|
||||||
$(document.body).off('.select2.' + this.container.id);
|
$(document.body).off('.select2.' + this.container.id);
|
||||||
@ -2575,6 +2585,11 @@ define('select2/dropdown',[
|
|||||||
return $dropdown;
|
return $dropdown;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Dropdown.prototype.position = function ($dropdown, $container) {
|
||||||
|
var $dropdownContainer = $container.find('.dropdown-wrapper');
|
||||||
|
$dropdownContainer.append($dropdown);
|
||||||
|
};
|
||||||
|
|
||||||
Dropdown.prototype.destroy = function () {
|
Dropdown.prototype.destroy = function () {
|
||||||
// Remove the dropdown from the DOM
|
// Remove the dropdown from the DOM
|
||||||
this.$dropdown.remove();
|
this.$dropdown.remove();
|
||||||
@ -3135,24 +3150,22 @@ define('select2/core',[
|
|||||||
|
|
||||||
var SelectionAdapter = this.options.get('selectionAdapter');
|
var SelectionAdapter = this.options.get('selectionAdapter');
|
||||||
this.selection = new SelectionAdapter($element, this.options);
|
this.selection = new SelectionAdapter($element, this.options);
|
||||||
|
this.$selection = this.selection.render();
|
||||||
|
|
||||||
var $selection = this.selection.render();
|
this.selection.position(this.$selection, $container);
|
||||||
|
|
||||||
this._placeSelection($selection);
|
|
||||||
|
|
||||||
var DropdownAdapter = this.options.get('dropdownAdapter');
|
var DropdownAdapter = this.options.get('dropdownAdapter');
|
||||||
this.dropdown = new DropdownAdapter($element, this.options);
|
this.dropdown = new DropdownAdapter($element, this.options);
|
||||||
|
this.$dropdown = this.dropdown.render();
|
||||||
|
|
||||||
var $dropdown = this.dropdown.render();
|
this.dropdown.position(this.$dropdown, $container);
|
||||||
|
|
||||||
this._placeDropdown($dropdown);
|
|
||||||
|
|
||||||
var ResultsAdapter = this.options.get('resultsAdapter');
|
var ResultsAdapter = this.options.get('resultsAdapter');
|
||||||
this.results = new ResultsAdapter($element, this.options, this.data);
|
this.results = new ResultsAdapter($element, this.options, this.data);
|
||||||
|
|
||||||
var $results = this.results.render();
|
this.$results = this.results.render();
|
||||||
|
|
||||||
this._placeResults($results);
|
this.results.position(this.$results, $container);
|
||||||
|
|
||||||
// Bind events
|
// Bind events
|
||||||
|
|
||||||
@ -3213,23 +3226,6 @@ define('select2/core',[
|
|||||||
$container.width(this.$element.outerWidth(false));
|
$container.width(this.$element.outerWidth(false));
|
||||||
};
|
};
|
||||||
|
|
||||||
Select2.prototype._placeSelection = function ($selection) {
|
|
||||||
var $selectionContainer = this.$container.find('.selection');
|
|
||||||
$selectionContainer.append($selection);
|
|
||||||
};
|
|
||||||
|
|
||||||
Select2.prototype._placeDropdown = function ($dropdown) {
|
|
||||||
this.$dropdown = $dropdown;
|
|
||||||
|
|
||||||
var $dropdownContainer = this.$container.find('.dropdown-wrapper');
|
|
||||||
$dropdownContainer.append($dropdown);
|
|
||||||
};
|
|
||||||
|
|
||||||
Select2.prototype._placeResults = function ($results) {
|
|
||||||
var $resultsContainer = this.$dropdown.find('.select2-results');
|
|
||||||
$resultsContainer.append($results);
|
|
||||||
};
|
|
||||||
|
|
||||||
Select2.prototype._bindAdapters = function () {
|
Select2.prototype._bindAdapters = function () {
|
||||||
this.data.bind(this, this.$container);
|
this.data.bind(this, this.$container);
|
||||||
this.selection.bind(this, this.$container);
|
this.selection.bind(this, this.$container);
|
||||||
|
46
dist/js/select2.full.js
vendored
46
dist/js/select2.full.js
vendored
@ -9765,6 +9765,11 @@ define('select2/results',[
|
|||||||
this.$results.append($options);
|
this.$results.append($options);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Results.prototype.position = function ($results, $container) {
|
||||||
|
var $resultsContainer = $container.find('.select2-results');
|
||||||
|
$resultsContainer.append($results);
|
||||||
|
};
|
||||||
|
|
||||||
Results.prototype.sort = function (data) {
|
Results.prototype.sort = function (data) {
|
||||||
return data;
|
return data;
|
||||||
};
|
};
|
||||||
@ -10259,6 +10264,11 @@ define('select2/selection/base',[
|
|||||||
$(document.body).off('mousedown.select2.' + container.id);
|
$(document.body).off('mousedown.select2.' + container.id);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
BaseSelection.prototype.position = function ($selection, $container) {
|
||||||
|
var $selectionContainer = $container.find('.selection');
|
||||||
|
$selectionContainer.append($selection);
|
||||||
|
};
|
||||||
|
|
||||||
BaseSelection.prototype.destroy = function () {
|
BaseSelection.prototype.destroy = function () {
|
||||||
// Unbind the dropdown click handler if it exists
|
// Unbind the dropdown click handler if it exists
|
||||||
$(document.body).off('.select2.' + this.container.id);
|
$(document.body).off('.select2.' + this.container.id);
|
||||||
@ -12110,6 +12120,11 @@ define('select2/dropdown',[
|
|||||||
return $dropdown;
|
return $dropdown;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Dropdown.prototype.position = function ($dropdown, $container) {
|
||||||
|
var $dropdownContainer = $container.find('.dropdown-wrapper');
|
||||||
|
$dropdownContainer.append($dropdown);
|
||||||
|
};
|
||||||
|
|
||||||
Dropdown.prototype.destroy = function () {
|
Dropdown.prototype.destroy = function () {
|
||||||
// Remove the dropdown from the DOM
|
// Remove the dropdown from the DOM
|
||||||
this.$dropdown.remove();
|
this.$dropdown.remove();
|
||||||
@ -12670,24 +12685,22 @@ define('select2/core',[
|
|||||||
|
|
||||||
var SelectionAdapter = this.options.get('selectionAdapter');
|
var SelectionAdapter = this.options.get('selectionAdapter');
|
||||||
this.selection = new SelectionAdapter($element, this.options);
|
this.selection = new SelectionAdapter($element, this.options);
|
||||||
|
this.$selection = this.selection.render();
|
||||||
|
|
||||||
var $selection = this.selection.render();
|
this.selection.position(this.$selection, $container);
|
||||||
|
|
||||||
this._placeSelection($selection);
|
|
||||||
|
|
||||||
var DropdownAdapter = this.options.get('dropdownAdapter');
|
var DropdownAdapter = this.options.get('dropdownAdapter');
|
||||||
this.dropdown = new DropdownAdapter($element, this.options);
|
this.dropdown = new DropdownAdapter($element, this.options);
|
||||||
|
this.$dropdown = this.dropdown.render();
|
||||||
|
|
||||||
var $dropdown = this.dropdown.render();
|
this.dropdown.position(this.$dropdown, $container);
|
||||||
|
|
||||||
this._placeDropdown($dropdown);
|
|
||||||
|
|
||||||
var ResultsAdapter = this.options.get('resultsAdapter');
|
var ResultsAdapter = this.options.get('resultsAdapter');
|
||||||
this.results = new ResultsAdapter($element, this.options, this.data);
|
this.results = new ResultsAdapter($element, this.options, this.data);
|
||||||
|
|
||||||
var $results = this.results.render();
|
this.$results = this.results.render();
|
||||||
|
|
||||||
this._placeResults($results);
|
this.results.position(this.$results, $container);
|
||||||
|
|
||||||
// Bind events
|
// Bind events
|
||||||
|
|
||||||
@ -12748,23 +12761,6 @@ define('select2/core',[
|
|||||||
$container.width(this.$element.outerWidth(false));
|
$container.width(this.$element.outerWidth(false));
|
||||||
};
|
};
|
||||||
|
|
||||||
Select2.prototype._placeSelection = function ($selection) {
|
|
||||||
var $selectionContainer = this.$container.find('.selection');
|
|
||||||
$selectionContainer.append($selection);
|
|
||||||
};
|
|
||||||
|
|
||||||
Select2.prototype._placeDropdown = function ($dropdown) {
|
|
||||||
this.$dropdown = $dropdown;
|
|
||||||
|
|
||||||
var $dropdownContainer = this.$container.find('.dropdown-wrapper');
|
|
||||||
$dropdownContainer.append($dropdown);
|
|
||||||
};
|
|
||||||
|
|
||||||
Select2.prototype._placeResults = function ($results) {
|
|
||||||
var $resultsContainer = this.$dropdown.find('.select2-results');
|
|
||||||
$resultsContainer.append($results);
|
|
||||||
};
|
|
||||||
|
|
||||||
Select2.prototype._bindAdapters = function () {
|
Select2.prototype._bindAdapters = function () {
|
||||||
this.data.bind(this, this.$container);
|
this.data.bind(this, this.$container);
|
||||||
this.selection.bind(this, this.$container);
|
this.selection.bind(this, this.$container);
|
||||||
|
4
dist/js/select2.full.min.js
vendored
4
dist/js/select2.full.min.js
vendored
File diff suppressed because one or more lines are too long
46
dist/js/select2.js
vendored
46
dist/js/select2.js
vendored
@ -658,6 +658,11 @@ define('select2/results',[
|
|||||||
this.$results.append($options);
|
this.$results.append($options);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Results.prototype.position = function ($results, $container) {
|
||||||
|
var $resultsContainer = $container.find('.select2-results');
|
||||||
|
$resultsContainer.append($results);
|
||||||
|
};
|
||||||
|
|
||||||
Results.prototype.sort = function (data) {
|
Results.prototype.sort = function (data) {
|
||||||
return data;
|
return data;
|
||||||
};
|
};
|
||||||
@ -1152,6 +1157,11 @@ define('select2/selection/base',[
|
|||||||
$(document.body).off('mousedown.select2.' + container.id);
|
$(document.body).off('mousedown.select2.' + container.id);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
BaseSelection.prototype.position = function ($selection, $container) {
|
||||||
|
var $selectionContainer = $container.find('.selection');
|
||||||
|
$selectionContainer.append($selection);
|
||||||
|
};
|
||||||
|
|
||||||
BaseSelection.prototype.destroy = function () {
|
BaseSelection.prototype.destroy = function () {
|
||||||
// Unbind the dropdown click handler if it exists
|
// Unbind the dropdown click handler if it exists
|
||||||
$(document.body).off('.select2.' + this.container.id);
|
$(document.body).off('.select2.' + this.container.id);
|
||||||
@ -3003,6 +3013,11 @@ define('select2/dropdown',[
|
|||||||
return $dropdown;
|
return $dropdown;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Dropdown.prototype.position = function ($dropdown, $container) {
|
||||||
|
var $dropdownContainer = $container.find('.dropdown-wrapper');
|
||||||
|
$dropdownContainer.append($dropdown);
|
||||||
|
};
|
||||||
|
|
||||||
Dropdown.prototype.destroy = function () {
|
Dropdown.prototype.destroy = function () {
|
||||||
// Remove the dropdown from the DOM
|
// Remove the dropdown from the DOM
|
||||||
this.$dropdown.remove();
|
this.$dropdown.remove();
|
||||||
@ -3563,24 +3578,22 @@ define('select2/core',[
|
|||||||
|
|
||||||
var SelectionAdapter = this.options.get('selectionAdapter');
|
var SelectionAdapter = this.options.get('selectionAdapter');
|
||||||
this.selection = new SelectionAdapter($element, this.options);
|
this.selection = new SelectionAdapter($element, this.options);
|
||||||
|
this.$selection = this.selection.render();
|
||||||
|
|
||||||
var $selection = this.selection.render();
|
this.selection.position(this.$selection, $container);
|
||||||
|
|
||||||
this._placeSelection($selection);
|
|
||||||
|
|
||||||
var DropdownAdapter = this.options.get('dropdownAdapter');
|
var DropdownAdapter = this.options.get('dropdownAdapter');
|
||||||
this.dropdown = new DropdownAdapter($element, this.options);
|
this.dropdown = new DropdownAdapter($element, this.options);
|
||||||
|
this.$dropdown = this.dropdown.render();
|
||||||
|
|
||||||
var $dropdown = this.dropdown.render();
|
this.dropdown.position(this.$dropdown, $container);
|
||||||
|
|
||||||
this._placeDropdown($dropdown);
|
|
||||||
|
|
||||||
var ResultsAdapter = this.options.get('resultsAdapter');
|
var ResultsAdapter = this.options.get('resultsAdapter');
|
||||||
this.results = new ResultsAdapter($element, this.options, this.data);
|
this.results = new ResultsAdapter($element, this.options, this.data);
|
||||||
|
|
||||||
var $results = this.results.render();
|
this.$results = this.results.render();
|
||||||
|
|
||||||
this._placeResults($results);
|
this.results.position(this.$results, $container);
|
||||||
|
|
||||||
// Bind events
|
// Bind events
|
||||||
|
|
||||||
@ -3641,23 +3654,6 @@ define('select2/core',[
|
|||||||
$container.width(this.$element.outerWidth(false));
|
$container.width(this.$element.outerWidth(false));
|
||||||
};
|
};
|
||||||
|
|
||||||
Select2.prototype._placeSelection = function ($selection) {
|
|
||||||
var $selectionContainer = this.$container.find('.selection');
|
|
||||||
$selectionContainer.append($selection);
|
|
||||||
};
|
|
||||||
|
|
||||||
Select2.prototype._placeDropdown = function ($dropdown) {
|
|
||||||
this.$dropdown = $dropdown;
|
|
||||||
|
|
||||||
var $dropdownContainer = this.$container.find('.dropdown-wrapper');
|
|
||||||
$dropdownContainer.append($dropdown);
|
|
||||||
};
|
|
||||||
|
|
||||||
Select2.prototype._placeResults = function ($results) {
|
|
||||||
var $resultsContainer = this.$dropdown.find('.select2-results');
|
|
||||||
$resultsContainer.append($results);
|
|
||||||
};
|
|
||||||
|
|
||||||
Select2.prototype._bindAdapters = function () {
|
Select2.prototype._bindAdapters = function () {
|
||||||
this.data.bind(this, this.$container);
|
this.data.bind(this, this.$container);
|
||||||
this.selection.bind(this, this.$container);
|
this.selection.bind(this, this.$container);
|
||||||
|
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
32
src/js/select2/core.js
vendored
32
src/js/select2/core.js
vendored
@ -30,24 +30,21 @@ define([
|
|||||||
|
|
||||||
var SelectionAdapter = this.options.get('selectionAdapter');
|
var SelectionAdapter = this.options.get('selectionAdapter');
|
||||||
this.selection = new SelectionAdapter($element, this.options);
|
this.selection = new SelectionAdapter($element, this.options);
|
||||||
|
this.$selection = this.selection.render();
|
||||||
|
|
||||||
var $selection = this.selection.render();
|
this.selection.position(this.$selection, $container);
|
||||||
|
|
||||||
this._placeSelection($selection);
|
|
||||||
|
|
||||||
var DropdownAdapter = this.options.get('dropdownAdapter');
|
var DropdownAdapter = this.options.get('dropdownAdapter');
|
||||||
this.dropdown = new DropdownAdapter($element, this.options);
|
this.dropdown = new DropdownAdapter($element, this.options);
|
||||||
|
this.$dropdown = this.dropdown.render();
|
||||||
|
|
||||||
var $dropdown = this.dropdown.render();
|
this.dropdown.position(this.$dropdown, $container);
|
||||||
|
|
||||||
this._placeDropdown($dropdown);
|
|
||||||
|
|
||||||
var ResultsAdapter = this.options.get('resultsAdapter');
|
var ResultsAdapter = this.options.get('resultsAdapter');
|
||||||
this.results = new ResultsAdapter($element, this.options, this.data);
|
this.results = new ResultsAdapter($element, this.options, this.data);
|
||||||
|
this.$results = this.results.render();
|
||||||
|
|
||||||
var $results = this.results.render();
|
this.results.position(this.$results, $container);
|
||||||
|
|
||||||
this._placeResults($results);
|
|
||||||
|
|
||||||
// Bind events
|
// Bind events
|
||||||
|
|
||||||
@ -108,23 +105,6 @@ define([
|
|||||||
$container.width(this.$element.outerWidth(false));
|
$container.width(this.$element.outerWidth(false));
|
||||||
};
|
};
|
||||||
|
|
||||||
Select2.prototype._placeSelection = function ($selection) {
|
|
||||||
var $selectionContainer = this.$container.find('.selection');
|
|
||||||
$selectionContainer.append($selection);
|
|
||||||
};
|
|
||||||
|
|
||||||
Select2.prototype._placeDropdown = function ($dropdown) {
|
|
||||||
this.$dropdown = $dropdown;
|
|
||||||
|
|
||||||
var $dropdownContainer = this.$container.find('.dropdown-wrapper');
|
|
||||||
$dropdownContainer.append($dropdown);
|
|
||||||
};
|
|
||||||
|
|
||||||
Select2.prototype._placeResults = function ($results) {
|
|
||||||
var $resultsContainer = this.$dropdown.find('.select2-results');
|
|
||||||
$resultsContainer.append($results);
|
|
||||||
};
|
|
||||||
|
|
||||||
Select2.prototype._bindAdapters = function () {
|
Select2.prototype._bindAdapters = function () {
|
||||||
this.data.bind(this, this.$container);
|
this.data.bind(this, this.$container);
|
||||||
this.selection.bind(this, this.$container);
|
this.selection.bind(this, this.$container);
|
||||||
|
5
src/js/select2/dropdown.js
vendored
5
src/js/select2/dropdown.js
vendored
@ -19,6 +19,11 @@ define([
|
|||||||
return $dropdown;
|
return $dropdown;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Dropdown.prototype.position = function ($dropdown, $container) {
|
||||||
|
var $dropdownContainer = $container.find('.dropdown-wrapper');
|
||||||
|
$dropdownContainer.append($dropdown);
|
||||||
|
};
|
||||||
|
|
||||||
Dropdown.prototype.destroy = function () {
|
Dropdown.prototype.destroy = function () {
|
||||||
// Remove the dropdown from the DOM
|
// Remove the dropdown from the DOM
|
||||||
this.$dropdown.remove();
|
this.$dropdown.remove();
|
||||||
|
5
src/js/select2/results.js
vendored
5
src/js/select2/results.js
vendored
@ -72,6 +72,11 @@ define([
|
|||||||
this.$results.append($options);
|
this.$results.append($options);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Results.prototype.position = function ($results, $container) {
|
||||||
|
var $resultsContainer = $container.find('.select2-results');
|
||||||
|
$resultsContainer.append($results);
|
||||||
|
};
|
||||||
|
|
||||||
Results.prototype.sort = function (data) {
|
Results.prototype.sort = function (data) {
|
||||||
return data;
|
return data;
|
||||||
};
|
};
|
||||||
|
5
src/js/select2/selection/base.js
vendored
5
src/js/select2/selection/base.js
vendored
@ -85,6 +85,11 @@ define([
|
|||||||
$(document.body).off('mousedown.select2.' + container.id);
|
$(document.body).off('mousedown.select2.' + container.id);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
BaseSelection.prototype.position = function ($selection, $container) {
|
||||||
|
var $selectionContainer = $container.find('.selection');
|
||||||
|
$selectionContainer.append($selection);
|
||||||
|
};
|
||||||
|
|
||||||
BaseSelection.prototype.destroy = function () {
|
BaseSelection.prototype.destroy = function () {
|
||||||
// Unbind the dropdown click handler if it exists
|
// Unbind the dropdown click handler if it exists
|
||||||
$(document.body).off('.select2.' + this.container.id);
|
$(document.body).off('.select2.' + this.container.id);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user