|
@@ -1556,18 +1556,26 @@ S2.define('select2/selection/multiple',[
|
|
|
});
|
|
|
});
|
|
|
|
|
|
- this.$selection.on('click', '.select2-selection__choice__remove',
|
|
|
+ this.$selection.on(
|
|
|
+ 'click',
|
|
|
+ '.select2-selection__choice__remove',
|
|
|
function (evt) {
|
|
|
- var $remove = $(this);
|
|
|
- var $selection = $remove.parent();
|
|
|
+ // Ignore the event if it is disabled
|
|
|
+ if (self.options.get('disabled')) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
|
|
|
- var data = $selection.data('data');
|
|
|
+ var $remove = $(this);
|
|
|
+ var $selection = $remove.parent();
|
|
|
|
|
|
- self.trigger('unselect', {
|
|
|
- originalEvent: evt,
|
|
|
- data: data
|
|
|
- });
|
|
|
- });
|
|
|
+ var data = $selection.data('data');
|
|
|
+
|
|
|
+ self.trigger('unselect', {
|
|
|
+ originalEvent: evt,
|
|
|
+ data: data
|
|
|
+ });
|
|
|
+ }
|
|
|
+ );
|
|
|
};
|
|
|
|
|
|
MultipleSelection.prototype.clear = function () {
|
|
@@ -3274,7 +3282,7 @@ S2.define('select2/data/array',[
|
|
|
var existingData = this.item($existingOption);
|
|
|
var newData = $.extend(true, {}, existingData, item);
|
|
|
|
|
|
- var $newOption = this.option(existingData);
|
|
|
+ var $newOption = this.option(newData);
|
|
|
|
|
|
$existingOption.replaceWith($newOption);
|
|
|
|
|
@@ -4014,6 +4022,12 @@ S2.define('select2/dropdown/attachBody',[
|
|
|
});
|
|
|
};
|
|
|
|
|
|
+ AttachBody.prototype.destroy = function (decorated) {
|
|
|
+ decorated.call(this);
|
|
|
+
|
|
|
+ this.$dropdownContainer.remove();
|
|
|
+ };
|
|
|
+
|
|
|
AttachBody.prototype.position = function (decorated, $dropdown, $container) {
|
|
|
// Clone all of the container classes
|
|
|
$dropdown.attr('class', $container.attr('class'));
|
|
@@ -4147,8 +4161,6 @@ S2.define('select2/dropdown/attachBody',[
|
|
|
};
|
|
|
|
|
|
AttachBody.prototype._resizeDropdown = function () {
|
|
|
- this.$dropdownContainer.width();
|
|
|
-
|
|
|
var css = {
|
|
|
width: this.$container.outerWidth(false) + 'px'
|
|
|
};
|