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({
|
.bindEvent({
|
||||||
change: function(data) {
|
change: function(data) {
|
||||||
self.selected = data.selected[0];
|
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});
|
that.triggerEvent('change', {selected: self.selected});
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
@ -35,13 +35,19 @@ Ox.TabPanel = function(options, self) {
|
||||||
size: 24
|
size: 24
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
element: self.options.content(self.selected)
|
element: getContent()
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
orientation: 'vertical'
|
orientation: 'vertical'
|
||||||
})
|
})
|
||||||
.addClass('OxTabPanel');
|
.addClass('OxTabPanel');
|
||||||
|
|
||||||
|
function getContent() {
|
||||||
|
return Ox.isObject(self.options.content)
|
||||||
|
? self.options.content[self.selected]
|
||||||
|
: self.options.content(self.selected);
|
||||||
|
}
|
||||||
|
|
||||||
function getSelected() {
|
function getSelected() {
|
||||||
return self.options.tabs.filter(function(tab) {
|
return self.options.tabs.filter(function(tab) {
|
||||||
return tab.selected;
|
return tab.selected;
|
||||||
|
|
Loading…
Reference in a new issue