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