From 3687620814a46a68119ddb2c14e5a2e03eadb151 Mon Sep 17 00:00:00 2001 From: rolux Date: Tue, 19 Jun 2012 15:06:57 +0200 Subject: [PATCH] update countries example --- examples/countries/js/example.js | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/examples/countries/js/example.js b/examples/countries/js/example.js index 87a3a75e..25e5fdd5 100644 --- a/examples/countries/js/example.js +++ b/examples/countries/js/example.js @@ -265,18 +265,18 @@ Ox.load(['Geo', 'UI'], function() { function renderItem() { var code = ui.selected[0]; $item.empty(); - if (ui.view == 'grid') { - Ox.TreeList({ - data: Ox.getCountryByCode(code), - scrollbarVisible: true, - width: itemSize - }) - .appendTo($item); - } else { - Ox.Element('') - .addClass('flag') - .attr({src: Ox.getFlagByCountryCode(code, 256)}) - .appendTo($item); + if (code) { + $item.append( + ui.view == 'grid' + ? Ox.TreeList({ + data: Ox.getCountryByCode(code), + scrollbarVisible: true, + width: itemSize + }) + : Ox.Element('') + .addClass('flag') + .attr({src: Ox.getFlagByCountryCode(code, 256)}) + ); } } @@ -339,13 +339,12 @@ Ox.load(['Geo', 'UI'], function() { data = $list.value(id); $title.options({title: data.name}).show(); $deselect.show(); - renderItem(); } else { ui.selected = []; $title.hide(); $deselect.hide(); - $item.empty(); } + renderItem(); } function sort(data) { @@ -368,6 +367,7 @@ Ox.load(['Geo', 'UI'], function() { $list = renderList(); $listPanel.replaceElement(1, $list); $list.gainFocus(); + renderItem(); } }); \ No newline at end of file