|
@@ -2883,9 +2883,17 @@ the specific language governing permissions and limitations under the Apache Lic
|
|
|
this.setVal(val);
|
|
|
if (this.select) this.postprocessResults();
|
|
|
}
|
|
|
- selected.remove();
|
|
|
|
|
|
- this.opts.element.trigger({ type: "removed", val: this.id(data), choice: data });
|
|
|
+ var evt = $.Event("select2-removing");
|
|
|
+ evt.val = this.id(data);
|
|
|
+ evt.choice = data;
|
|
|
+ this.opts.element.trigger(evt);
|
|
|
+
|
|
|
+ if (evt.isDefaultPrevented()) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ this.opts.element.trigger({ type: "select2-removed", val: this.id(data), choice: data });
|
|
|
this.triggerChange({ removed: data });
|
|
|
},
|
|
|
|