fix for enter key
This commit is contained in:
parent
47e0c28de9
commit
81d27621bf
1 changed files with 28 additions and 22 deletions
|
@ -1914,36 +1914,42 @@ 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")) {
|
||||||
if (that.options("parent")) {
|
clickItem(position);
|
||||||
that.options("parent").hideMenu();
|
|
||||||
}
|
|
||||||
if (!item.options("items").length) {
|
|
||||||
if (item.options("checked") !== null && (!item.options("group") || !item.options("checked"))) {
|
|
||||||
item.options({
|
|
||||||
checked: !item.options("checked")
|
|
||||||
});
|
|
||||||
Ox.Event.trigger("click." + that.id, {
|
|
||||||
id: item.options("id"),
|
|
||||||
value: item.options("title")[0] // fixme: value or title?
|
|
||||||
});
|
|
||||||
}
|
|
||||||
if (item.options("title").length == 2) {
|
|
||||||
item.toggleTitle();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function clickItem() {
|
function clickItem(position) {
|
||||||
// called on key.enter
|
var item = that.items[position];
|
||||||
|
if (that.options("parent")) {
|
||||||
|
that.options("parent").hideMenu();
|
||||||
|
}
|
||||||
|
if (!item.options("items").length) {
|
||||||
|
if (item.options("checked") !== null && (!item.options("group") || !item.options("checked"))) {
|
||||||
|
item.options({
|
||||||
|
checked: !item.options("checked")
|
||||||
|
});
|
||||||
|
Ox.Event.trigger("click." + that.id, {
|
||||||
|
id: item.options("id"),
|
||||||
|
value: item.options("title")[0] // fixme: value or title?
|
||||||
|
});
|
||||||
|
}
|
||||||
|
if (item.options("title").length == 2) {
|
||||||
|
item.toggleTitle();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function clickSelectedItem() {
|
||||||
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);
|
||||||
|
|
Loading…
Reference in a new issue