update countries example

This commit is contained in:
rolux 2012-06-19 15:06:57 +02:00
parent b5749bfaeb
commit 3687620814

View file

@ -265,18 +265,18 @@ Ox.load(['Geo', 'UI'], function() {
function renderItem() { function renderItem() {
var code = ui.selected[0]; var code = ui.selected[0];
$item.empty(); $item.empty();
if (ui.view == 'grid') { if (code) {
Ox.TreeList({ $item.append(
data: Ox.getCountryByCode(code), ui.view == 'grid'
scrollbarVisible: true, ? Ox.TreeList({
width: itemSize data: Ox.getCountryByCode(code),
}) scrollbarVisible: true,
.appendTo($item); width: itemSize
} else { })
Ox.Element('<img>') : Ox.Element('<img>')
.addClass('flag') .addClass('flag')
.attr({src: Ox.getFlagByCountryCode(code, 256)}) .attr({src: Ox.getFlagByCountryCode(code, 256)})
.appendTo($item); );
} }
} }
@ -339,13 +339,12 @@ Ox.load(['Geo', 'UI'], function() {
data = $list.value(id); data = $list.value(id);
$title.options({title: data.name}).show(); $title.options({title: data.name}).show();
$deselect.show(); $deselect.show();
renderItem();
} else { } else {
ui.selected = []; ui.selected = [];
$title.hide(); $title.hide();
$deselect.hide(); $deselect.hide();
$item.empty();
} }
renderItem();
} }
function sort(data) { function sort(data) {
@ -368,6 +367,7 @@ Ox.load(['Geo', 'UI'], function() {
$list = renderList(); $list = renderList();
$listPanel.replaceElement(1, $list); $listPanel.replaceElement(1, $list);
$list.gainFocus(); $list.gainFocus();
renderItem();
} }
}); });