forked from 0x2620/oxjs
some changes to events
This commit is contained in:
parent
9b40330982
commit
73ea43ec01
4 changed files with 30 additions and 20 deletions
|
|
@ -907,10 +907,10 @@ requires
|
|||
*/
|
||||
if (Ox.isObject(arguments[0])) {
|
||||
$.each(arguments[0], function(event, fn) {
|
||||
Ox.Event.trigger(event + "_" + that.id, fn);
|
||||
Ox.Event.trigger(event + "_" + self.options.id, fn);
|
||||
});
|
||||
} else {
|
||||
Ox.Event.trigger(arguments[0] + "_" + that.id, arguments[1] || {});
|
||||
Ox.Event.trigger(arguments[0] + "_" + self.options.id, arguments[1] || {});
|
||||
}
|
||||
return that;
|
||||
}
|
||||
|
|
@ -1746,8 +1746,9 @@ requires
|
|||
size: "medium"
|
||||
})
|
||||
.options(options)
|
||||
.addClass("OxSelect Ox" + Ox.toTitleCase(self.options.size)),
|
||||
selected;
|
||||
.addClass("OxSelect Ox" + Ox.toTitleCase(self.options.size));
|
||||
self.buttonId = self.options.id + "_button"
|
||||
self.menuId = self.options.id + "_menu",
|
||||
|
||||
$.each(self.options.items, function(i, item) {
|
||||
self.options.items[i] = $.extend(self.options.items[i], {
|
||||
|
|
@ -1755,14 +1756,14 @@ requires
|
|||
group: self.options.id,
|
||||
});
|
||||
if (item.checked) {
|
||||
selected = i;
|
||||
self.selected = i;
|
||||
}
|
||||
});
|
||||
|
||||
that.$button = new Ox.Button($.extend(self.options, {
|
||||
id: self.options.id,
|
||||
id: self.buttonId,
|
||||
type: "text", // fixme: this shouldn't be necessary
|
||||
value: self.options.items[selected].title
|
||||
value: self.options.items[self.selected].title
|
||||
}), {})
|
||||
.click(clickButton)
|
||||
.appendTo(that);
|
||||
|
|
@ -1778,7 +1779,7 @@ requires
|
|||
|
||||
that.$menu = new Ox.Menu({
|
||||
element: that.$button,
|
||||
id: self.options.id,
|
||||
id: self.menuId,
|
||||
items: self.options.items,
|
||||
offset: {
|
||||
left: 8,
|
||||
|
|
@ -1788,11 +1789,11 @@ requires
|
|||
size: self.options.size
|
||||
});
|
||||
|
||||
that.bindEvent("change_" + that.$button.id, changeButton);
|
||||
that.bindEvent("click_" + that.$menu.id, clickMenu);
|
||||
that.bindEvent("change_" + self.buttonId, changeButton);
|
||||
that.bindEvent("click_" + self.menuId + "_menu", clickMenu);
|
||||
|
||||
function changeButton(event, data) {
|
||||
that.triggerEvent("change_" + that.id, data);
|
||||
that.triggerEvent("change", data);
|
||||
}
|
||||
|
||||
function clickButton() {
|
||||
|
|
@ -1846,6 +1847,7 @@ requires
|
|||
that.menus = [];
|
||||
|
||||
$.each(options.menus, function(position, menu) {
|
||||
var event =
|
||||
that.titles[position] = $("<div>")
|
||||
.addClass("OxTitle")
|
||||
.html(menu.title)
|
||||
|
|
@ -1856,8 +1858,7 @@ requires
|
|||
mainmenu: that,
|
||||
size: self.options.size
|
||||
}));
|
||||
Ox.print("binding", "click_" + that.menus[position].id)
|
||||
that.bindEvent("click_" + that.menus[position].id, clickMenu);
|
||||
that.bindEvent("click_" + that.menus[position].options("id"), clickMenu);
|
||||
});
|
||||
|
||||
function click(event) {
|
||||
|
|
@ -2040,9 +2041,12 @@ requires
|
|||
Ox.print("...", position, item)
|
||||
if (!item.options("disabled")) {
|
||||
clickItem(position);
|
||||
} else {
|
||||
that.triggerEvent("click");
|
||||
}
|
||||
} else {
|
||||
that.triggerEvent("click");
|
||||
}
|
||||
that.triggerEvent("click");
|
||||
}
|
||||
|
||||
function clickItem(position) {
|
||||
|
|
@ -2056,8 +2060,7 @@ requires
|
|||
item.options({
|
||||
checked: !item.options("checked")
|
||||
});
|
||||
Ox.Event.trigger("click_" + that.id, {
|
||||
id: item.options("id"),
|
||||
Ox.Event.trigger("click_" + item.options("id"), {
|
||||
value: item.options("title")[0] // fixme: value or title?
|
||||
});
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue