properly update list status
This commit is contained in:
parent
11e98db160
commit
a48113684d
1 changed files with 11 additions and 1 deletions
|
@ -272,8 +272,8 @@ Ox.ListMap = function(options, self) {
|
||||||
|
|
||||||
self.$status = Ox.Element()
|
self.$status = Ox.Element()
|
||||||
.css({paddingTop: '2px', margin: 'auto', fontSize: '9px', textAlign: 'center'})
|
.css({paddingTop: '2px', margin: 'auto', fontSize: '9px', textAlign: 'center'})
|
||||||
.html(self.options.places.length + ' Place' + (self.options.places.length == 1 ? '' : 's'))
|
|
||||||
.appendTo(self.$listStatusbar);
|
.appendTo(self.$listStatusbar);
|
||||||
|
setStatus();
|
||||||
|
|
||||||
self.$placeTitlebar = Ox.Bar({
|
self.$placeTitlebar = Ox.Bar({
|
||||||
size: 24
|
size: 24
|
||||||
|
@ -410,11 +410,13 @@ Ox.ListMap = function(options, self) {
|
||||||
self.$map.addPlace(place);
|
self.$map.addPlace(place);
|
||||||
self.$list.options({items: Ox.clone(self.options.places)});
|
self.$list.options({items: Ox.clone(self.options.places)});
|
||||||
self.$list.options({selected: [place.id]});
|
self.$list.options({selected: [place.id]});
|
||||||
|
setStatus();
|
||||||
self.$placeButton.options({title: 'Remove Place'})
|
self.$placeButton.options({title: 'Remove Place'})
|
||||||
} else if (title == 'Remove Place') {
|
} else if (title == 'Remove Place') {
|
||||||
var index = Ox.getPositionById(self.options.places, self.selectedPlace);
|
var index = Ox.getPositionById(self.options.places, self.selectedPlace);
|
||||||
self.options.places.splice(index, 1);
|
self.options.places.splice(index, 1);
|
||||||
self.$list.options({items: Ox.clone(self.options.places)});
|
self.$list.options({items: Ox.clone(self.options.places)});
|
||||||
|
setStatus();
|
||||||
self.$map.removePlace();
|
self.$map.removePlace();
|
||||||
self.$placeButton.options({title: 'Add Place'});
|
self.$placeButton.options({title: 'Add Place'});
|
||||||
}
|
}
|
||||||
|
@ -601,6 +603,14 @@ Ox.ListMap = function(options, self) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function setStatus() {
|
||||||
|
self.$status.html(
|
||||||
|
self.options.places.length + ' Place' + (
|
||||||
|
self.options.places.length == 1 ? '' : 's'
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
function toFixed(val) {
|
function toFixed(val) {
|
||||||
return Ox.isNumber(val) ? val.toFixed(8) : val; // fixme: why can a string be passed ??
|
return Ox.isNumber(val) ? val.toFixed(8) : val; // fixme: why can a string be passed ??
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue