adding change event for option groups, updating select

This commit is contained in:
Rolux 2010-02-09 17:55:42 +05:30
parent aa80fc4d51
commit ebf6072b54

View file

@ -1753,12 +1753,13 @@ requires
.options(options) .options(options)
.addClass("OxSelect Ox" + Ox.toTitleCase(self.options.size)); .addClass("OxSelect Ox" + Ox.toTitleCase(self.options.size));
self.buttonId = self.options.id + "_button" self.buttonId = self.options.id + "_button"
self.groupId = self.options.id + "_group"
self.menuId = self.options.id + "_menu", self.menuId = self.options.id + "_menu",
$.each(self.options.items, function(i, item) { $.each(self.options.items, function(i, item) {
self.options.items[i] = $.extend(self.options.items[i], { self.options.items[i] = $.extend(self.options.items[i], {
checked: item.checked || false, checked: item.checked || false,
group: self.options.id, group: self.groupId
}); });
if (item.checked) { if (item.checked) {
self.selected = i; self.selected = i;
@ -1794,7 +1795,7 @@ requires
size: self.options.size size: self.options.size
}); });
that.bindEvent("click_" + self.menuId, clickMenu); that.bindEvent("change_" + self.groupId, clickMenu);
function clickButton() { function clickButton() {
that.$menu.toggleMenu(); that.$menu.toggleMenu();
@ -2052,10 +2053,6 @@ 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")