fix for enter key

This commit is contained in:
Rolux 2010-02-07 20:42:14 +05:30
parent 057909b5cd
commit e8c225a879

View File

@ -1914,11 +1914,20 @@ requires
function click(event) { function click(event) {
var item, var item,
position,
$target = $(event.target); $target = $(event.target);
that.hideMenu(); that.hideMenu();
if ($target.is(".OxCell")) { if ($target.is(".OxCell")) {
item = that.items[$target.parent().data("position")]; position = $target.parent().data("position");
item = that.items[position];
if (!item.options("disabled")) { if (!item.options("disabled")) {
clickItem(position);
}
}
}
function clickItem(position) {
var item = that.items[position];
if (that.options("parent")) { if (that.options("parent")) {
that.options("parent").hideMenu(); that.options("parent").hideMenu();
} }
@ -1937,13 +1946,10 @@ requires
} }
} }
} }
}
}
function clickItem() { function clickSelectedItem() {
// called on key.enter
if (self.options.selected > -1) { if (self.options.selected > -1) {
that.items[self.options.selected].trigger("click"); clickItem(self.options.selected);
} else { } else {
that.hideMenu(); that.hideMenu();
} }
@ -2279,7 +2285,7 @@ requires
key_left: selectSupermenu, key_left: selectSupermenu,
key_right: selectSubmenu, key_right: selectSubmenu,
key_escape: that.hideMenu, key_escape: that.hideMenu,
key_enter: clickItem key_enter: clickSelectedItem
}); });
setTimeout(function() { setTimeout(function() {
$document.bind("click", click); $document.bind("click", click);