Ox.DocPanel: when navigating to folder in list, don't deselect it

This commit is contained in:
rolux 2012-06-13 12:08:54 +02:00
parent 3136c8f381
commit 9d877800b4

View file

@ -275,7 +275,8 @@ Ox.DocPanel = function(options, self) {
.bindEvent({ .bindEvent({
select: function(data) { select: function(data) {
selectItem( selectItem(
data.ids.length ? Ox.last(data.ids[0].split('/')) : '' data.ids.length ? Ox.last(data.ids[0].split('/')) : '',
true
); );
} }
}); });
@ -309,7 +310,7 @@ Ox.DocPanel = function(options, self) {
}); });
} }
function selectItem(id) { function selectItem(id, fromList) {
var item = id ? getItemByName(id) : null; var item = id ? getItemByName(id) : null;
if (item) { if (item) {
self.options.selected = id; self.options.selected = id;
@ -333,7 +334,7 @@ Ox.DocPanel = function(options, self) {
that.$element.replaceElement(1, self.$page); that.$element.replaceElement(1, self.$page);
} else { } else {
self.options.selected = ''; self.options.selected = '';
self.$list.options({selected: []}); !fromList && 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});