update DocPanel and ExamplePanel

This commit is contained in:
rolux 2012-04-16 09:13:22 +02:00
parent d060a94131
commit 606497fbdd
2 changed files with 6 additions and 4 deletions

View file

@ -47,7 +47,7 @@ Ox.DocPanel = function(options, self) {
.options(options || {}); .options(options || {});
self.$list = Ox.Element(); self.$list = Ox.Element();
self.$page = Ox.Element().append(self.options.element); self.$page = Ox.Element();
that.setElement( that.setElement(
self.$panel = Ox.SplitPanel({ self.$panel = Ox.SplitPanel({
@ -174,6 +174,8 @@ Ox.DocPanel = function(options, self) {
that.$element.replaceElement(1, self.$page); that.$element.replaceElement(1, self.$page);
that.triggerEvent('select', {id: self.options.selected}); that.triggerEvent('select', {id: self.options.selected});
} }
} else {
self.$page.empty().append(self.options.element);
} }
} }

View file

@ -17,7 +17,7 @@ Ox.ExamplePanel = function(options, self) {
.options(options || {}) .options(options || {})
self.$list = Ox.Element(); self.$list = Ox.Element();
self.$page = Ox.Element().append(self.options.element); self.$page = Ox.Element();
that.setElement( that.setElement(
self.$panel = Ox.SplitPanel({ self.$panel = Ox.SplitPanel({
@ -63,6 +63,7 @@ Ox.ExamplePanel = function(options, self) {
} }
}); });
self.$panel.replaceElement(0, self.$list); self.$panel.replaceElement(0, self.$list);
selectItem(self.options.selected);
that.triggerEvent('load', {}); that.triggerEvent('load', {});
}); });
@ -108,7 +109,7 @@ Ox.ExamplePanel = function(options, self) {
}) })
); );
} else { } else {
self.$page.empty() self.$page.empty().append(self.options.element);
} }
self.options.selected = id; self.options.selected = id;
that.triggerEvent('select', {id: id}); that.triggerEvent('select', {id: id});
@ -116,7 +117,6 @@ Ox.ExamplePanel = function(options, self) {
self.setOption = function(key, value) { self.setOption = function(key, value) {
if (key == 'selected') { if (key == 'selected') {
Ox.print('SETTING LIST SELECTED TO', [value])
self.$list.options({selected: [value]}); self.$list.options({selected: [value]});
} }
}; };