fix a bug in listmap, regarding removal of places
This commit is contained in:
parent
13e52cdca7
commit
0ca93fcebe
2 changed files with 12 additions and 6 deletions
|
@ -569,6 +569,7 @@ Ox.List = function(options, self) {
|
|||
// fixme: is this really needed?
|
||||
var pos = -1;
|
||||
Ox.forEach(self.$items, function($item, i) {
|
||||
//Ox.print('$item', i, self.options.unique, $item.options('data')[self.options.unique])
|
||||
if ($item.options('data')[self.options.unique] == id) {
|
||||
pos = i;
|
||||
return false;
|
||||
|
@ -1656,6 +1657,7 @@ Ox.List = function(options, self) {
|
|||
var pos = Ox.isNumber(id) ? id : getPositionById(id),
|
||||
$item = self.$items[pos],
|
||||
data = $item.options('data');
|
||||
Ox.print('((((()))))', id, pos)
|
||||
if (arguments.length == 1) {
|
||||
return data;
|
||||
} else if (arguments.length == 2) {
|
||||
|
@ -1667,7 +1669,9 @@ Ox.List = function(options, self) {
|
|||
return id_ == data[key] ? value : id_
|
||||
});
|
||||
}
|
||||
self.options.items[pos][key] = value;
|
||||
if (!self.isAsync) {
|
||||
self.options.items[pos][key] = value;
|
||||
}
|
||||
data[key] = value;
|
||||
$item.options({data: data});
|
||||
return that;
|
||||
|
|
|
@ -682,21 +682,23 @@ Ox.ListMap = function(options, self) {
|
|||
}
|
||||
|
||||
function removePlace() {
|
||||
var index = Ox.getPositionById(self.options.places, self.selectedPlace);
|
||||
var index;
|
||||
Ox.print('REMOVE PLACE', self.selectedPlace, index)
|
||||
if (!self.isAsync) {
|
||||
index = Ox.getPositionById(self.options.places, self.selectedPlace);
|
||||
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', {id: self.selectedPlace});
|
||||
// fixme: what is this? both options.removePlace and event removeplace??
|
||||
if (self.isAsync) {
|
||||
self.options.removePlace({id: self.selectedPlace}, function() {
|
||||
self.$list.options({selected: []}).reloadList(true);
|
||||
});
|
||||
}
|
||||
|
||||
self.$map.removePlace();
|
||||
self.$placeButton.options({title: 'Add Place'});
|
||||
that.triggerEvent('removeplace', {id: self.selectedPlace});
|
||||
}
|
||||
|
||||
function initList(data) {
|
||||
|
|
Loading…
Reference in a new issue