ExamplePanel: don't fail when selecting non-existing id
This commit is contained in:
parent
542be904ea
commit
a3f0a38bf2
1 changed files with 5 additions and 5 deletions
|
@ -108,9 +108,9 @@ Ox.ExamplePanel = function(options, self) {
|
|||
}
|
||||
|
||||
function selectItem(id) {
|
||||
var item;
|
||||
if (id) {
|
||||
item = Ox.getObjectById(self.items, id);
|
||||
var item = id ? Ox.getObjectById(self.items, id) : null
|
||||
if (item) {
|
||||
self.options.selected = id;
|
||||
self.$panel.replaceElement(1,
|
||||
self.$page = Ox.ExamplePage({
|
||||
height: window.innerHeight,
|
||||
|
@ -129,11 +129,11 @@ Ox.ExamplePanel = function(options, self) {
|
|||
})
|
||||
);
|
||||
} else {
|
||||
self.options.selected = '';
|
||||
self.$list.options({selected: []});
|
||||
self.$page.empty().append(self.options.element);
|
||||
}
|
||||
self.options.selected = id;
|
||||
that.triggerEvent('select', {id: id});
|
||||
that.triggerEvent('select', {id: self.options.selected});
|
||||
}
|
||||
|
||||
return that;
|
||||
|
|
Loading…
Reference in a new issue