don't close menu on enter, but submit input on enter in autocompletemenu if no menu item was selected

This commit is contained in:
rlx 2013-07-22 12:58:07 +00:00
parent 256c0cfa0d
commit dc0c504809
2 changed files with 8 additions and 6 deletions

View file

@ -482,7 +482,7 @@ Ox.Input = function(options, self) {
}
function constructAutocompleteMenu() {
var menu = Ox.Menu({
return Ox.Menu({
element: self.$input,
id: self.options.id + 'Menu', // fixme: we do this in other places ... are we doing it the same way? var name?,
maxWidth: self.options.autocompleteSelectMaxWidth,
@ -490,13 +490,17 @@ Ox.Input = function(options, self) {
left: 4,
top: 0
}
//size: self.options.size
})
.addClass('OxAutocompleteMenu')
.bindEvent({
click: clickMenu
click: clickMenu,
key_enter: function() {
if (self.$autocompleteMenu.is(':visible')) {
self.$autocompleteMenu.hideMenu();
submit();
}
}
});
return menu;
}
function autovalidate() {

View file

@ -192,8 +192,6 @@ Ox.Menu = function(options, self) {
// called on key.enter
if (self.options.selected > -1) {
clickItem(self.options.selected);
} else {
that.hideMenu();
}
}