TabPanel: add reloadPanel method; react to setting content option

This commit is contained in:
rlx 2012-06-16 10:07:52 +00:00
parent 165bd0457a
commit dffd160ed3

View file

@ -23,7 +23,12 @@ Ox.TabPanel = function(options, self) {
size: 24,
tabs: []
})
.options(options || {});
.options(options || {})
.update({
content: function() {
self.$panel.replaceElement(1, getContent());
}
});
self.selected = getSelected();
@ -45,8 +50,7 @@ Ox.TabPanel = function(options, self) {
})
.appendTo(self.$bar);
that.setElement(
Ox.SplitPanel({
self.$panel = Ox.SplitPanel({
elements: [
{
element: self.$bar,
@ -58,8 +62,9 @@ Ox.TabPanel = function(options, self) {
],
orientation: 'vertical'
})
.addClass('OxTabPanel')
);
.addClass('OxTabPanel');
that.setElement(self.$panel);
function getContent() {
return Ox.isObject(self.options.content)
@ -74,6 +79,12 @@ Ox.TabPanel = function(options, self) {
return (selected.length ? selected : self.options.tabs)[0].id;
}
//@ reloadPanel <f> reload panel
that.reloadPanel = function() {
self.$panel.replaceElement(1, getContent());
return that;
};
/*@
select <f> select
(id) -> <o> select panel