added openOnEnter option. fixes #319
This commit is contained in:
parent
b7a3f957e3
commit
4f6bf6cc81
17
select2.js
17
select2.js
@ -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: "",
|
||||||
|
Loading…
Reference in New Issue
Block a user