make listmap trigger add/remove place events
This commit is contained in:
parent
fada9f8a0c
commit
96b597d324
1 changed files with 16 additions and 9 deletions
|
@ -407,20 +407,27 @@ Ox.ListMap = function(options, self) {
|
|||
place.countryCode = country ? country.code : '';
|
||||
self.selectedPlace = self.selectedPlace.substr(1); // fixme: safe?
|
||||
place.id = self.selectedPlace;
|
||||
if (Ox.isArray(self.options.place)) {
|
||||
self.options.places.push(place);
|
||||
//self.options.places[Ox.getPositionById(self.options.places, self.selectedPlace)] = place;
|
||||
self.$map.addPlace(place);
|
||||
self.$list.options({items: Ox.clone(self.options.places)});
|
||||
self.$list.options({selected: [place.id]});
|
||||
self.$list.options({
|
||||
items: Ox.clone(self.options.places),
|
||||
selected: [place.id]
|
||||
});
|
||||
setStatus();
|
||||
self.$placeButton.options({title: 'Remove Place'})
|
||||
}
|
||||
self.$map.addPlace(place);
|
||||
self.$placeButton.options({title: 'Remove Place'});
|
||||
that.triggerEvent('addplace', {place: place});
|
||||
} else if (title == 'Remove Place') {
|
||||
var index = Ox.getPositionById(self.options.places, self.selectedPlace);
|
||||
if (Ox.isArray(self.options.place)) {
|
||||
self.options.places.splice(index, 1);
|
||||
self.$list.options({items: Ox.clone(self.options.places)});
|
||||
setStatus();
|
||||
}
|
||||
self.$map.removePlace();
|
||||
self.$placeButton.options({title: 'Add Place'});
|
||||
that.triggerEvent('removeplace', {place: place});
|
||||
}
|
||||
Ox.print('PLACES.LENGTH', self.options.places.length)
|
||||
Ox.print('ITEMS.LENGTH', self.$list.options('items').length)
|
||||
|
|
Loading…
Reference in a new issue