in TabPanel, make sure content can be array or function
This commit is contained in:
parent
14aafa5487
commit
5dc9b1e45b
1 changed files with 8 additions and 2 deletions
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue