diff --git a/source/Ox.UI/js/Panel/TabPanel.js b/source/Ox.UI/js/Panel/TabPanel.js index 8fcb556d..47df27d0 100644 --- a/source/Ox.UI/js/Panel/TabPanel.js +++ b/source/Ox.UI/js/Panel/TabPanel.js @@ -31,6 +31,7 @@ Ox.TabPanel = function(options, self) { } }); + self.isObject = Ox.isObject(self.options.content); self.selected = getSelected(); self.$bar = Ox.Bar({size: 24}); @@ -45,7 +46,7 @@ Ox.TabPanel = function(options, self) { .bindEvent({ change: function(data) { self.selected = data.value; - that.$element.replaceElement(1, getContent()); + self.$panel.replaceElement(1, getContent()); that.triggerEvent('change', {selected: self.selected}); } }) @@ -68,7 +69,7 @@ Ox.TabPanel = function(options, self) { that.setElement(self.$panel); function getContent() { - return Ox.isObject(self.options.content) + return self.isObject ? self.options.content[self.selected] : self.options.content(self.selected); }