forked from 0x2620/oxjs
make map in async listmap async
This commit is contained in:
parent
14174136d8
commit
93408b0b4d
4 changed files with 167 additions and 135 deletions
|
|
@ -922,14 +922,37 @@ Ox.Map = function(options, self) {
|
|||
}
|
||||
|
||||
function selectPlace(id) {
|
||||
// id can be null (deselect)
|
||||
var place,
|
||||
selected = getSelectedMarker();
|
||||
//Ox.print('Ox.Map selectPlace()', id, selected);
|
||||
Ox.print('Ox.Map selectPlace()', id, selected);
|
||||
if (id != selected) {
|
||||
place = getPlaceById(selected);
|
||||
place && place.deselect();
|
||||
place = getPlaceById(id);
|
||||
place && place.select();
|
||||
if (id !== null) {
|
||||
place = getPlaceById(id);
|
||||
if (place) {
|
||||
select();
|
||||
} else {
|
||||
// async && place doesn't exist yet
|
||||
self.options.places({
|
||||
query: {
|
||||
key: 'id',
|
||||
value: id,
|
||||
operator: '='
|
||||
}
|
||||
}, function(results) {
|
||||
place = new Ox.MapPlace(Ox.extend({
|
||||
map: that
|
||||
}, results.data.items[0])).add();
|
||||
self.places.push(place);
|
||||
select();
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
function select() {
|
||||
place.select();
|
||||
self.options.selected = id;
|
||||
setStatus();
|
||||
that.triggerEvent('selectplace', place);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue