Ox.api: return api from update method; Ox.List: update api when updating options.items array

This commit is contained in:
rolux 2014-04-30 13:54:19 +02:00
parent c26a13b2f1
commit 38b7072822
2 changed files with 6 additions and 8 deletions

View file

@ -95,15 +95,9 @@ Ox.List = function(options, self) {
updateItems();
} else {
if (Ox.isArray(self.options.items)) {
// FIXME: duplicated
// FIXME: retarded workaround
self.items = self.options.items;
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
});
self.options.items = self.itemsAPI.update(self.items);
/*
self.listLength = self.options.items.length;
updateSelected();
@ -140,6 +134,9 @@ Ox.List = function(options, self) {
sums: self.options.sums,
unique: self.options.unique
});
// FIXME: this is retarded, only needed because setting items later will
// overwrite the items API.
self.itemsAPI = self.options.items;
}
that.$content.bindEvent({

View file

@ -310,6 +310,7 @@ Ox.api = function(items, options) {
items = updatedItems;
api.cache && ret.clear();
sortBy.clear();
return ret;
}
}
),