DocPanel: don't empty page when selecting module or section folder

This commit is contained in:
rolux 2012-06-22 09:22:58 +02:00
parent c301a73e38
commit 0200a2478b

View file

@ -274,16 +274,16 @@ Ox.DocPanel = function(options, self) {
? getIcon
: Ox.UI.getImageURL('symbolCenter'),
items: treeItems,
selected: self.options.selected
? [self.options.selected] : '',
selected: self.options.selected ? [self.options.selected] : '',
width: self.options.size
})
.bindEvent({
select: function(data) {
selectItem(
data.ids.length ? Ox.last(data.ids[0].split('/')) : '',
true
);
if (!data.ids[0] || !Ox.endsWith(data.ids[0], '/')) {
selectItem(
data.ids[0] ? data.ids[0].split('/').pop() : ''
);
}
}
});
self.$sidebar.replaceElement(0, self.$list);
@ -316,7 +316,7 @@ Ox.DocPanel = function(options, self) {
});
}
function selectItem(id, fromList) {
function selectItem(id) {
var item = id ? getItemByName(id) : null;
if (item) {
self.options.selected = id;
@ -337,10 +337,10 @@ Ox.DocPanel = function(options, self) {
that.triggerEvent('example', data);
}
});
that.$element.replaceElement(1, self.$page);
self.$panel.replaceElement(1, self.$page);
} else {
self.options.selected = '';
!fromList && self.$list.options({selected: []});
self.$list.options({selected: []});
self.$page.empty().append(self.options.element);
}
that.triggerEvent('select', {id: self.options.selected});