From 38b7072822a855775162a146ec087853df24bc3f Mon Sep 17 00:00:00 2001 From: rolux Date: Wed, 30 Apr 2014 13:54:19 +0200 Subject: [PATCH] Ox.api: return api from update method; Ox.List: update api when updating options.items array --- source/Ox.UI/js/List/List.js | 13 +++++-------- source/Ox/js/Array.js | 1 + 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/source/Ox.UI/js/List/List.js b/source/Ox.UI/js/List/List.js index 200a0ce1..046df559 100644 --- a/source/Ox.UI/js/List/List.js +++ b/source/Ox.UI/js/List/List.js @@ -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({ diff --git a/source/Ox/js/Array.js b/source/Ox/js/Array.js index d627978c..693a3f45 100644 --- a/source/Ox/js/Array.js +++ b/source/Ox/js/Array.js @@ -310,6 +310,7 @@ Ox.api = function(items, options) { items = updatedItems; api.cache && ret.clear(); sortBy.clear(); + return ret; } } ),