Skip to content

Commit f3b3dac

Browse files
committed
added on 'enter_pressed_after_select'
1 parent ada2dcd commit f3b3dac

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

src/selectize.js

+8-2
Original file line numberDiff line numberDiff line change
@@ -487,8 +487,12 @@ $.extend(Selectize.prototype, {
487487
e.preventDefault();
488488
return;
489489
case KEY_RETURN:
490+
var callbackAfterSelect = function() {
491+
self.trigger('enter_pressed_after_select', self);
492+
};
493+
490494
if (self.isOpen && self.$activeOption) {
491-
self.onOptionSelect({currentTarget: self.$activeOption});
495+
self.onOptionSelect({currentTarget: self.$activeOption}, callbackAfterSelect);
492496
e.preventDefault();
493497
}
494498
return;
@@ -655,7 +659,7 @@ $.extend(Selectize.prototype, {
655659
* @param {object} e
656660
* @returns {boolean}
657661
*/
658-
onOptionSelect: function(e) {
662+
onOptionSelect: function(e, callbackAfterSelect) {
659663
var value, $target, $option, self = this;
660664

661665
if (e.preventDefault) {
@@ -669,6 +673,7 @@ $.extend(Selectize.prototype, {
669673
if (self.settings.closeAfterSelect) {
670674
self.close();
671675
}
676+
callbackAfterSelect && callbackAfterSelect();
672677
});
673678
} else {
674679
value = $target.attr('data-value');
@@ -681,6 +686,7 @@ $.extend(Selectize.prototype, {
681686
} else if (!self.settings.hideSelected && e.type && /mouse/.test(e.type)) {
682687
self.setActiveOption(self.getOption(value));
683688
}
689+
callbackAfterSelect && callbackAfterSelect();
684690
}
685691
}
686692
},

0 commit comments

Comments
 (0)