1
0
mirror of synced 2024-11-26 23:06:02 +03:00

added openOnEnter option. fixes #319

This commit is contained in:
Igor Vaynberg 2012-08-13 14:51:56 -07:00
parent b7a3f957e3
commit 4f6bf6cc81

View File

@ -1420,6 +1420,10 @@
return; return;
} }
if (this.opts.openOnEnter === false && e.which === KEY.ENTER) {
return;
}
this.open(); this.open();
if (e.which === KEY.ENTER) { if (e.which === KEY.ENTER) {
@ -1475,7 +1479,11 @@
} }
if (e.which === KEY.TAB || KEY.isControl(e) || KEY.isFunctionKey(e) if (e.which === KEY.TAB || KEY.isControl(e) || KEY.isFunctionKey(e)
|| e.which === KEY.ESC || e.which == KEY.ENTER) { || e.which === KEY.ESC) {
return;
}
if (this.opts.openOnEnter === false && e.which === KEY.ENTER) {
return; return;
} }
@ -1807,7 +1815,11 @@
} }
if (e.which === KEY.TAB || KEY.isControl(e) || KEY.isFunctionKey(e) if (e.which === KEY.TAB || KEY.isControl(e) || KEY.isFunctionKey(e)
|| e.which === KEY.BACKSPACE || e.which === KEY.ESC || e.which === KEY.ENTER) { || e.which === KEY.BACKSPACE || e.which === KEY.ESC) {
return;
}
if (this.opts.openOnEnter === false && e.which === KEY.ENTER) {
return; return;
} }
@ -2284,6 +2296,7 @@
$.fn.select2.defaults = { $.fn.select2.defaults = {
width: "copy", width: "copy",
closeOnSelect: true, closeOnSelect: true,
openOnEnter: true,
containerCss: {}, containerCss: {},
dropdownCss: {}, dropdownCss: {},
containerCssClass: "", containerCssClass: "",