From 319608b5ac01a44efd70373213dffe7fc01da4a9 Mon Sep 17 00:00:00 2001 From: j <0x006A@0x2620.org> Date: Tue, 31 Jan 2012 13:23:24 +0000 Subject: [PATCH] fix selecting tab via .select in tab panel --- source/Ox.UI/js/Form/Ox.ButtonGroup.js | 10 ++++++++++ source/Ox.UI/js/Panel/Ox.TabPanel.js | 2 +- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/source/Ox.UI/js/Form/Ox.ButtonGroup.js b/source/Ox.UI/js/Form/Ox.ButtonGroup.js index c57b5047..8c9bc129 100644 --- a/source/Ox.UI/js/Form/Ox.ButtonGroup.js +++ b/source/Ox.UI/js/Form/Ox.ButtonGroup.js @@ -96,6 +96,16 @@ Ox.ButtonGroup = function(options, self) { } } + self.setOption = function(key, value) { + if (key == 'value') { + // fixme: this doesn't work in cases where + // multiple buttons can be selected + var position = Ox.getIndexById(self.options.buttons, value); + 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 f952be05..94f85c01 100644 --- a/source/Ox.UI/js/Panel/Ox.TabPanel.js +++ b/source/Ox.UI/js/Panel/Ox.TabPanel.js @@ -57,7 +57,7 @@ Ox.TabPanel = function(options, self) { that.select = function(id) { if (Ox.getIndexById(self.options.tabs, id) > -1) { - self.$tabs.select(id); + self.$tabs.options({value: id}); } };