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