fix for main menu

This commit is contained in:
Rolux 2010-02-09 17:50:23 +05:30
parent 42332e8936
commit b8460e2ef9

View File

@ -1906,9 +1906,11 @@ requires
function onHideMenu() { function onHideMenu() {
Ox.print("hideMenu self.selected", self.selected) Ox.print("hideMenu self.selected", self.selected)
that.titles[self.selected].removeClass("OxSelected"); if (self.selected > -1) {
that.titles[self.selected].removeClass("OxSelected");
self.selected = -1;
}
self.focused = false; self.focused = false;
self.selected = -1;
} }
self.onChange = function(key, value) { self.onChange = function(key, value) {
@ -2035,9 +2037,12 @@ requires
item = that.items[position]; item = that.items[position];
if (!item.options("disabled")) { if (!item.options("disabled")) {
clickItem(position); clickItem(position);
} else {
that.hideMenu();
} }
} else {
that.hideMenu();
} }
that.hideMenu();
} }
function clickItem(position) { function clickItem(position) {
@ -2047,21 +2052,26 @@ requires
if (that.options("parent")) { if (that.options("parent")) {
that.options("parent").hideMenu().triggerEvent("click"); that.options("parent").hideMenu().triggerEvent("click");
} }
Ox.Event.trigger("click_" + self.options.id, {
id: item.options("id"),
value: item.options("title")[0] // fixme: value or title?
});
if (item.options("checked") !== null && (!item.options("group") || !item.options("checked"))) { if (item.options("checked") !== null && (!item.options("group") || !item.options("checked"))) {
item.options({ item.options({
checked: !item.options("checked") checked: !item.options("checked")
}); });
Ox.Event.trigger("click_" + self.options.id, { Ox.Event.trigger("change_" + item.options("group"), {
id: item.options("id"), id: item.options("id"),
value: item.options("title")[0] // fixme: value or title? value: item.options("title")[0] // fixme: value or title?
})
Ox.Event.trigger("click_" + item.options("id"), {
}); });
} else {
Ox.Event.trigger("click_" + item.options("id"));
} }
if (item.options("title").length == 2) { if (item.options("title").length == 2) {
item.toggleTitle(); item.toggleTitle();
} }
} }
that.hideMenu();
} }
function clickSelectedItem() { function clickSelectedItem() {