diff --git a/source/Ox.UI/js/List/List.js b/source/Ox.UI/js/List/List.js index c3ab788f..200a0ce1 100644 --- a/source/Ox.UI/js/List/List.js +++ b/source/Ox.UI/js/List/List.js @@ -1819,14 +1819,14 @@ 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])) { return data[arguments[1]]; } else if ($item) { Ox.forEach(Ox.makeObject(args), function(value, key) { - var index; if (key == self.options.unique) { // unique id has changed self.options.selected = self.options.selected.map(function(id_) { @@ -1837,13 +1837,15 @@ Ox.List = function(options, self) { self.options.items[pos][key] = value; } else if (self.items) { // items array was passed to initialize the list - index = Ox.getIndexById(self.items, id); - self.items[index][key] = value; - self.options.items.update(index, self.items[index]); + self.items[Ox.getIndexById(self.items, id)][key] = value; + updateItems = true; } data[key] = value; }); $item.options({data: data}); + if (updateItems) { + self.options.items.update(self.items); + } return that; } }; diff --git a/source/Ox/js/Array.js b/source/Ox/js/Array.js index 000e5583..d627978c 100644 --- a/source/Ox/js/Array.js +++ b/source/Ox/js/Array.js @@ -306,11 +306,10 @@ Ox.api = function(items, options) { ret = Ox.extend( api.cache ? Ox.cache(fn, {async: true}) : fn, { - update: function(index, item) { - items[index] = item; + update: function(updatedItems) { + items = updatedItems; api.cache && ret.clear(); sortBy.clear(); - return items; } } ),