diff --git a/source/Ox.UI/js/Code/ExamplePanel.js b/source/Ox.UI/js/Code/ExamplePanel.js index 95867381..6a1022d6 100644 --- a/source/Ox.UI/js/Code/ExamplePanel.js +++ b/source/Ox.UI/js/Code/ExamplePanel.js @@ -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;