DocPanel: don't empty page when selecting module or section folder
This commit is contained in:
parent
c301a73e38
commit
0200a2478b
1 changed files with 9 additions and 9 deletions
|
@ -274,16 +274,16 @@ Ox.DocPanel = function(options, self) {
|
||||||
? getIcon
|
? getIcon
|
||||||
: Ox.UI.getImageURL('symbolCenter'),
|
: Ox.UI.getImageURL('symbolCenter'),
|
||||||
items: treeItems,
|
items: treeItems,
|
||||||
selected: self.options.selected
|
selected: self.options.selected ? [self.options.selected] : '',
|
||||||
? [self.options.selected] : '',
|
|
||||||
width: self.options.size
|
width: self.options.size
|
||||||
})
|
})
|
||||||
.bindEvent({
|
.bindEvent({
|
||||||
select: function(data) {
|
select: function(data) {
|
||||||
selectItem(
|
if (!data.ids[0] || !Ox.endsWith(data.ids[0], '/')) {
|
||||||
data.ids.length ? Ox.last(data.ids[0].split('/')) : '',
|
selectItem(
|
||||||
true
|
data.ids[0] ? data.ids[0].split('/').pop() : ''
|
||||||
);
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
self.$sidebar.replaceElement(0, self.$list);
|
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;
|
var item = id ? getItemByName(id) : null;
|
||||||
if (item) {
|
if (item) {
|
||||||
self.options.selected = id;
|
self.options.selected = id;
|
||||||
|
@ -337,10 +337,10 @@ Ox.DocPanel = function(options, self) {
|
||||||
that.triggerEvent('example', data);
|
that.triggerEvent('example', data);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
that.$element.replaceElement(1, self.$page);
|
self.$panel.replaceElement(1, self.$page);
|
||||||
} else {
|
} else {
|
||||||
self.options.selected = '';
|
self.options.selected = '';
|
||||||
!fromList && self.$list.options({selected: []});
|
self.$list.options({selected: []});
|
||||||
self.$page.empty().append(self.options.element);
|
self.$page.empty().append(self.options.element);
|
||||||
}
|
}
|
||||||
that.triggerEvent('select', {id: self.options.selected});
|
that.triggerEvent('select', {id: self.options.selected});
|
||||||
|
|
Loading…
Reference in a new issue