From 5dc9b1e45b4ca07074e2708962863324173e48a8 Mon Sep 17 00:00:00 2001 From: rolux Date: Wed, 30 Nov 2011 15:37:02 +0100 Subject: [PATCH] in TabPanel, make sure content can be array or function --- source/Ox.UI/js/Panel/Ox.TabPanel.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/source/Ox.UI/js/Panel/Ox.TabPanel.js b/source/Ox.UI/js/Panel/Ox.TabPanel.js index bf4b3509..7f18ea9b 100644 --- a/source/Ox.UI/js/Panel/Ox.TabPanel.js +++ b/source/Ox.UI/js/Panel/Ox.TabPanel.js @@ -22,7 +22,7 @@ Ox.TabPanel = function(options, self) { .bindEvent({ change: function(data) { self.selected = data.selected[0]; - that.$element.replaceElement(1, self.options.content(self.selected)); + that.$element.replaceElement(1, getContent()); that.triggerEvent('change', {selected: self.selected}); } }) @@ -35,13 +35,19 @@ Ox.TabPanel = function(options, self) { size: 24 }, { - element: self.options.content(self.selected) + element: getContent() } ], orientation: 'vertical' }) .addClass('OxTabPanel'); + function getContent() { + return Ox.isObject(self.options.content) + ? self.options.content[self.selected] + : self.options.content(self.selected); + } + function getSelected() { return self.options.tabs.filter(function(tab) { return tab.selected;