From b8a5457cf2ab3b0fc0a14076d569031648292880 Mon Sep 17 00:00:00 2001 From: Leonardo Coelho Date: Sat, 31 Oct 2015 18:35:19 +0000 Subject: [PATCH] Update GeoDropdown.js --- js/GeoDropdown.js | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/js/GeoDropdown.js b/js/GeoDropdown.js index 539c77e..fe1cb94 100644 --- a/js/GeoDropdown.js +++ b/js/GeoDropdown.js @@ -215,9 +215,16 @@ geoDropdown.prototype.geoClick = function(geo,instance,geonameid) { // order data self.names.sort(function(a, b) { - if(a.name < b.name) return -1; - if(a.name > b.name) return 1; - return 0; + if(self.level==1 || (self.level==-1 && self.continent=="default_continent")){ + if(getCountryName(a.name) < getCountryName(b.name)) return -1; + if(getCountryName(a.name) > getCountryName(b.name)) return 1; + return 0; + } + else{ + if(a.name < b.name) return -1; + if(a.name > b.name) return 1; + return 0; + } }); // add the required data to 3D array