diff --git a/source/Ox.UI/js/Form/Ox.Input.js b/source/Ox.UI/js/Form/Ox.Input.js index b97a0339..3634b226 100644 --- a/source/Ox.UI/js/Form/Ox.Input.js +++ b/source/Ox.UI/js/Form/Ox.Input.js @@ -829,7 +829,13 @@ Ox.Input = function(options, self) { // fixme: deprecate, options are enough that.value = function() { - return self.$input.hasClass('OxPlaceholder') ? '' : self.$input.val(); + var value = self.$input.hasClass('OxPlaceholder') ? '' : self.$input.val(); + if (self.options.type == 'float') { + value = parseFloat(value); + } else if (self.options.type == 'int') { + value = parseInt(value); // cannot have leading zero + } + return value; }; return that; diff --git a/source/Ox.UI/js/List/Ox.List.js b/source/Ox.UI/js/List/Ox.List.js index 41b62619..55418d24 100644 --- a/source/Ox.UI/js/List/Ox.List.js +++ b/source/Ox.UI/js/List/Ox.List.js @@ -1216,6 +1216,7 @@ Ox.List = function(options, self) { } function updateSort(map) { + Ox.print('start sort') var key = self.options.sort[0].key, operator = self.options.sort[0].operator; if (self.listLength > 1) { @@ -1237,13 +1238,13 @@ Ox.List = function(options, self) { getPositions(); } } + Ox.print('end sort') } self.setOption = function(key, value) { - Ox.print('list setOption', key, value); + //Ox.print('list setOption', key, value); if (key == 'items') { if (Ox.typeOf(value) == 'array') { - loadItems(); updateSort(); } else { updateQuery(); diff --git a/source/Ox.UI/js/List/Ox.TextList.js b/source/Ox.UI/js/List/Ox.TextList.js index b0809a5b..35c8776b 100644 --- a/source/Ox.UI/js/List/Ox.TextList.js +++ b/source/Ox.UI/js/List/Ox.TextList.js @@ -351,6 +351,7 @@ Ox.TextList = function(options, self) { width: getItemWidth() + 'px' }); self.visibleColumns.forEach(function(v, i) { + //Ox.print(data[v.id], '(--value--)') var clickable = Ox.isBoolean(v.clickable) ? v.clickable : v.clickable(data), editable = Ox.isBoolean(v.editable) ? v.editable : v.editable(data), $cell = $('
') @@ -626,7 +627,7 @@ Ox.TextList = function(options, self) { } self.setOption = function(key, value) { - Ox.print('---------------------------- TextList setOption', key, value) + //Ox.print('---------------------------- TextList setOption', key, value) if (key == 'items') { that.$body.options(key, value); } else if (key == 'paste') { diff --git a/source/Ox.UI/js/Map/Ox.ListMap.js b/source/Ox.UI/js/Map/Ox.ListMap.js index b9a120db..98368dfd 100644 --- a/source/Ox.UI/js/Map/Ox.ListMap.js +++ b/source/Ox.UI/js/Map/Ox.ListMap.js @@ -110,33 +110,6 @@ Ox.ListMap = function(options, self) { visible: true, width: 192 }, - { - align: 'right', - format: {type: 'area', args: [0]}, - id: 'area', - operator: '-', - title: 'Area', - visible: true, - width: 128 - }, - { - align: 'right', - format: toFixed, - id: 'lat', - operator: '+', - title: 'Latitude', - visible: true, - width: 96 - }, - { - align: 'right', - format: toFixed, - id: 'lng', - operator: '+', - title: 'Longitude', - visible: true, - width: 96 - }, { align: 'right', format: toFixed, @@ -172,6 +145,33 @@ Ox.ListMap = function(options, self) { visible: false, width: 96 }, + { + align: 'right', + format: toFixed, + id: 'lat', + operator: '+', + title: 'Latitude', + visible: true, + width: 96 + }, + { + align: 'right', + format: toFixed, + id: 'lng', + operator: '+', + title: 'Longitude', + visible: true, + width: 96 + }, + { + align: 'right', + format: {type: 'area', args: [0]}, + id: 'area', + operator: '-', + title: 'Area', + visible: true, + width: 128 + }, { id: 'user', operator: '+', @@ -347,6 +347,7 @@ Ox.ListMap = function(options, self) { label: 'Area', labelWidth: 80, textAlign: 'right', + type: 'float', width: 240 }) ]); @@ -374,10 +375,13 @@ Ox.ListMap = function(options, self) { self.$map.newPlace(); self.$placeButton.options({title: 'Add Place'}) } else if (title == 'Add Place') { - var place = self.$placeForm.values(); + var place = self.$placeForm.values(), + country = Ox.getCountryByGeoname(place.geoname); + place.countryCode = country ? country.code : ''; place.id = self.selectedPlace.substr(1); // fixme: safe? self.options.places.push(place); self.$map.addPlace(place); + //self.$placeButton.options({title: 'Please Wait...'}) self.$list.options({items: Ox.clone(self.options.places)}); self.$list.options({selected: [place.id]}); //self.$list.addItem(place); diff --git a/source/Ox.UI/js/Map/Ox.Map.js b/source/Ox.UI/js/Map/Ox.Map.js index 27daa36f..24ee7860 100644 --- a/source/Ox.UI/js/Map/Ox.Map.js +++ b/source/Ox.UI/js/Map/Ox.Map.js @@ -407,13 +407,14 @@ Ox.Map = function(options, self) { } function addPlaceToPlaces(data) { - var place = getSelectedPlace(); + var place = getSelectedPlace(), + country = Ox.getCountryByGeoname(place.geoname); if (self.options.selected == place.id) { self.options.selected = place.id.substr(1); } place.id = place.id.substr(1); // fixme: NOT SAFE! Ox.extend(place, data); - place.countryCode = Ox.getCountryByGeoname(place.geoname).code; + place.countryCode = country ? country.code : ''; place.marker.update(); self.places.push(place); self.resultPlace = null; diff --git a/source/Ox.UI/js/Map/Ox.MapPlace.js b/source/Ox.UI/js/Map/Ox.MapPlace.js index 56610da9..0c8bc2b4 100644 --- a/source/Ox.UI/js/Map/Ox.MapPlace.js +++ b/source/Ox.UI/js/Map/Ox.MapPlace.js @@ -67,7 +67,7 @@ Ox.MapPlace = function(options) { Ox.EARTH_CIRCUMFERENCE / 360; that.sizeEastWest = (that.east + (that.west > that.east ? 360 : 0) - that.west) * Ox.getMetersPerDegree(that.lat); - that.size = Ox.getArea( + that.area = Ox.getArea( {lat: that.south, lng: that.west}, {lat: that.north, lng: that.east} );