fix setting value on array lists
This commit is contained in:
parent
bb0b8c247c
commit
7b5d24461d
1 changed files with 14 additions and 1 deletions
|
@ -1819,7 +1819,8 @@ Ox.List = function(options, self) {
|
|||
id = args.shift(),
|
||||
pos = Ox.isNumber(id) ? id : getPositionById(id),
|
||||
$item = self.$items[pos],
|
||||
data = $item ? $item.options('data') : {};
|
||||
data = $item ? $item.options('data') : {},
|
||||
updateItems = false;
|
||||
if (arguments.length == 1) {
|
||||
return data;
|
||||
} else if (arguments.length == 2 && Ox.isString(arguments[1])) {
|
||||
|
@ -1834,10 +1835,22 @@ Ox.List = function(options, self) {
|
|||
}
|
||||
if (!self.isAsync) {
|
||||
self.options.items[pos][key] = value;
|
||||
} else if(self.items) {
|
||||
self.items[Ox.getIndexById(self.items, id)][key] = value;
|
||||
updateItems = true;
|
||||
}
|
||||
data[key] = value;
|
||||
});
|
||||
$item.options({data: data});
|
||||
if (updateItems) {
|
||||
self.options.items = Ox.api(self.items, {
|
||||
cache: true,
|
||||
map: self.options.map,
|
||||
sort: self.options.sort,
|
||||
sums: self.options.sums,
|
||||
unique: self.options.unique
|
||||
});
|
||||
}
|
||||
return that;
|
||||
}
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue