diff --git a/source/Ox.UI/js/Form/Ox.ButtonGroup.js b/source/Ox.UI/js/Form/Ox.ButtonGroup.js index 7ba2e6a0..4615c8ad 100644 --- a/source/Ox.UI/js/Form/Ox.ButtonGroup.js +++ b/source/Ox.UI/js/Form/Ox.ButtonGroup.js @@ -75,5 +75,15 @@ Ox.ButtonGroup = function(options, self) { } } + that.select = function(id) { + // fixme: this doesn't work in cases where + // multiple buttons can be selected + var position = Ox.getPositionById(self.options.buttons, id); + if (position > -1) { + self.$buttons[position].trigger('click'); + } + }; + return that; + }; diff --git a/source/Ox.UI/js/Panel/Ox.TabPanel.js b/source/Ox.UI/js/Panel/Ox.TabPanel.js index 6ce45070..bf4b3509 100644 --- a/source/Ox.UI/js/Panel/Ox.TabPanel.js +++ b/source/Ox.UI/js/Panel/Ox.TabPanel.js @@ -20,12 +20,10 @@ Ox.TabPanel = function(options, self) { selectable: true, }) .bindEvent({ - change: function(event) { - self.selected = event.selected[0]; + change: function(data) { + self.selected = data.selected[0]; that.$element.replaceElement(1, self.options.content(self.selected)); - that.triggerEvent('change', { - selected: self.selected - }); + that.triggerEvent('change', {selected: self.selected}); } }) .appendTo(self.$bar); @@ -50,6 +48,12 @@ Ox.TabPanel = function(options, self) { })[0].id; } + that.select = function(id) { + if (Ox.getPositionById(self.options.tabs, id) > -1) { + self.$tabs.select(id); + } + }; + that.selected = function() { return self.selected; };