1
0
Fork 0
forked from 0x2620/oxjs

fix a bug in listmap, regarding removal of places

This commit is contained in:
rlx 2011-10-02 17:05:56 +00:00
commit 0ca93fcebe
2 changed files with 12 additions and 6 deletions

View file

@ -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;